mirror of
https://github.com/fspc/dswim.git
synced 2025-04-04 08:13:24 -04:00
A little prettfycation.
This commit is contained in:
parent
755d28ab44
commit
3ef714b05c
864
swim
864
swim
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
#use diagnostics;
|
|
||||||
require 5.004;
|
require 5.004;
|
||||||
use strict;
|
use strict;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
@ -8,32 +8,38 @@ use SWIM::Global;
|
|||||||
use SWIM::Library;
|
use SWIM::Library;
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
############################################################################
|
||||||
# Package administration and research tool for Debian #
|
#
|
||||||
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum #
|
# Package administration and research tool for Debian
|
||||||
# #
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify #
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum
|
||||||
# it under the terms of the GNU General Public License as published by #
|
#
|
||||||
# the Free Software Foundation; either version 2 of the License, or #
|
#
|
||||||
# (at your option) any later version. #
|
#
|
||||||
# #
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# This program is distributed in the hope that it will be useful, #
|
#
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
# it under the terms of the GNU General Public License as published by
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
# GNU General Public License for more details. #
|
# (at your option) any later version.
|
||||||
# #
|
#
|
||||||
# You should have received a copy of the GNU General Public License #
|
# This program is distributed in the hope that it will be useful,
|
||||||
# along with this program; if not, write to the Free Software #
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
################################################################################
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA
|
||||||
|
#
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
|
||||||
Description: Show World Intelligent Management
|
Description: System Wide Information System
|
||||||
Show World Packaging Method or ....
|
|
||||||
|
|
||||||
Swim is a program which adds rpm-like quering capabilities to the Debian
|
SWIM is a program which adds rpm-like quering capabilities to the Debian
|
||||||
system. Information for an installed Debian system is extracted from the
|
system. Information for an installed Debian system is extracted from the
|
||||||
/var/lib/dpkg/info* files and the status file, information for an uninstalled
|
/var/lib/dpkg/info* files and the status file, information for an uninstalled
|
||||||
(not-installed) system is extracted from Packages and Contents files which can
|
(not-installed) system is extracted from Packages and Contents files which can
|
||||||
@ -83,114 +89,116 @@ anyone, find the program to do the job easily.
|
|||||||
|
|
||||||
# The MAIN
|
# The MAIN
|
||||||
# First let's determine what options are being used.
|
# First let's determine what options are being used.
|
||||||
|
my $home = $ENV{'HOME'};
|
||||||
|
|
||||||
|
|
||||||
Getopt::Long::config("bundling","no_auto_abbrev"); # will use pass_through
|
Getopt::Long::config("bundling","no_auto_abbrev"); # will use pass_through
|
||||||
|
|
||||||
my($result) =
|
my($result) =
|
||||||
GetOptions (\%commands,
|
GetOptions (\%commands,
|
||||||
"query", "q", # query
|
"query", "q", # query
|
||||||
"b", # build
|
"b", # build
|
||||||
"a", # all packages = /.
|
"a", # all packages = /.
|
||||||
"f", # file query
|
"f", # file query
|
||||||
"dir", # same as "f", but verifies dir
|
"dir", # same as "f", but verifies dir
|
||||||
"i", # information
|
"i", # information
|
||||||
"l", # file listing
|
"l", # file listing
|
||||||
"df", # file/directory listing w/-l
|
"df", # file/directory listing w/-l
|
||||||
"v", # verbose listing
|
"v", # verbose listing
|
||||||
"p", # package query
|
"p", # package query
|
||||||
"extract=s", # extract all files/file from package
|
"extract=s", # extract all files/file from package
|
||||||
"remove", "r", # remove all, but conf.
|
"remove", "r", # remove all, but conf.
|
||||||
"purge", # remove it all
|
"purge", # remove it all
|
||||||
"apt", # apt-get
|
"apt", # apt-get
|
||||||
"update", # using sources.list
|
"update", # using sources.list
|
||||||
"clean", # remove archives or apt2ftp
|
"clean", # remove archives or apt2ftp
|
||||||
"autoclean", # remove some archives
|
"autoclean", # remove some archives
|
||||||
"upgrade", # currently installed packages
|
"upgrade", # currently installed packages
|
||||||
"dist_upgrade", # whole dist. upgrade
|
"dist_upgrade", # whole dist. upgrade
|
||||||
"x", # simulate apt's actions
|
"x", # simulate apt's actions
|
||||||
"y", # automatic yes for -z
|
"y", # automatic yes for -z
|
||||||
"z", # apt install
|
"z", # apt install
|
||||||
"nz", # apt download
|
"nz", # apt download
|
||||||
"source", # ftp source and package
|
"source", # ftp source and package
|
||||||
"source_only", # ftp only source for package
|
"source_only", # ftp only source for package
|
||||||
"diff", # just grab diff for source
|
"diff", # just grab diff for source
|
||||||
"stdin", # read in from stdin
|
"stdin", # read in from stdin
|
||||||
"md5sum", # show md5sum
|
"md5sum", # show md5sum
|
||||||
"c", # configuration files
|
"c", # configuration files
|
||||||
"d", # show documentation
|
"d", # show documentation
|
||||||
"g", # packages belonging to group (27)
|
"g", # packages belonging to group (27)
|
||||||
"allgroups", # show all groups
|
"allgroups", # show all groups
|
||||||
"n", # not-installed
|
"n", # not-installed
|
||||||
"pre_depends", # required before installation
|
"pre_depends", # required before installation
|
||||||
"depends", # like requires, def. needed
|
"depends", # like requires, def. needed
|
||||||
"recommends", # packages important to this one
|
"recommends", # packages important to this one
|
||||||
"suggests", # complimentary packages
|
"suggests", # complimentary packages
|
||||||
"replaces", # package(s) being replaces
|
"replaces", # package(s) being replaces
|
||||||
"provides", # capabilities provided (virtual)
|
"provides", # capabilities provided (virtual)
|
||||||
"conflicts", # package(s) which conflict
|
"conflicts", # package(s) which conflict
|
||||||
"T", # all characteristics
|
"T", # all characteristics
|
||||||
"shlibs", # provided shared libraries
|
"shlibs", # provided shared libraries
|
||||||
"total", "t", # when there is more than one
|
"total", "t", # when there is more than one
|
||||||
"no", # no output on searches
|
"no", # no output on searches
|
||||||
"scripts", # the scripts
|
"scripts", # the scripts
|
||||||
"preinst", # before inst. script
|
"preinst", # before inst. script
|
||||||
"postinst", # after inst. script
|
"postinst", # after inst. script
|
||||||
"prerm", # before removal script
|
"prerm", # before removal script
|
||||||
"postrm", # after removal script
|
"postrm", # after removal script
|
||||||
"menu", "m", # menu script
|
"menu", "m", # menu script
|
||||||
"copyright", # copyright
|
"copyright", # copyright
|
||||||
"changelog", # changelog.Debian.gz changelog.gz
|
"changelog", # changelog.Debian.gz changelog.gz
|
||||||
"root=s", # use alternative db & root dir
|
"root=s", # use alternative db & root dir
|
||||||
"db", # update the database
|
"db", # update the database
|
||||||
"initdb", # make the databases
|
"initdb", # make the databases
|
||||||
"rebuilddb", # remake the database
|
"rebuilddb", # remake the database
|
||||||
"lowmem", # lowmem method
|
"lowmem", # lowmem method
|
||||||
"initndb", # make not-installed database
|
"initndb", # make not-installed database
|
||||||
"ndb", # update not-installed database
|
"ndb", # update not-installed database
|
||||||
"report", # report for --ndb
|
"report", # report for --ndb
|
||||||
"check", # show changes|update cache
|
"check", # show changes|update cache
|
||||||
"rebuildndb", # remake not-installed database
|
"rebuildndb", # remake not-installed database
|
||||||
"cron", # intelligent cron
|
"cron", # intelligent cron
|
||||||
"Contents=s", # Contents file required
|
"Contents=s", # Contents file required
|
||||||
"onec", # download only 1 Contents
|
"onec", # download only 1 Contents
|
||||||
"nue", # non-US or Exp. in Contents
|
"nue", # non-US or Exp. in Contents
|
||||||
"main", # this section and/or
|
"main", # this section and/or
|
||||||
"contrib", # this section and/or
|
"contrib", # this section and/or
|
||||||
"non-free", # this section and/or
|
"non-free", # this section and/or
|
||||||
"non-us", # this section and/or
|
"non-us", # this section and/or
|
||||||
"arch=s", # architecture - i386 ...
|
"arch=s", # architecture - i386 ...
|
||||||
"dists=s", # distribution - stable ...
|
"dists=s", # distribution - stable ...
|
||||||
"alt=s", # alternative base for dist
|
"alt=s", # alternative base for dist
|
||||||
"dbpath=s", # override default db location
|
"dbpath=s", # override default db location
|
||||||
"split_data=s", # make things faster
|
"split_data=s", # make things faster
|
||||||
"rebuildflatdb", # rebuild flat databases
|
"rebuildflatdb", # rebuild flat databases
|
||||||
"rebuildflatndb", # rebuild n-flat databases
|
"rebuildflatndb", # rebuild n-flat databases
|
||||||
"nopager", "n", # no pager
|
"nopager", "n", # no pager
|
||||||
"search=s", # search database for package
|
"search=s", # search database for package
|
||||||
"powersearch=s", # match files, directories, and
|
"powersearch=s", # match files, directories, and
|
||||||
"ps=s", # packages.
|
"ps=s", # packages.
|
||||||
"research=s", # search the results
|
"research=s", # search the results
|
||||||
"refinesearch=s", # refine the existing search
|
"refinesearch=s", # refine the existing search
|
||||||
"searchfile", # search databases
|
"searchfile", # search databases
|
||||||
"cs", # case sensitive search
|
"cs", # case sensitive search
|
||||||
"S", # query packages from search
|
"S", # query packages from search
|
||||||
"C", "audit", # dpkg standard options
|
"C", "audit", # dpkg standard options
|
||||||
"status", # clues one in about -C
|
"status", # clues one in about -C
|
||||||
"status_only", # n* update
|
"status_only", # n* update
|
||||||
"ramdiskon", # turn on the thing
|
"ramdiskon", # turn on the thing
|
||||||
"ramdiskoff", # turn it off
|
"ramdiskoff", # turn it off
|
||||||
"ftp", # ftp client protocol
|
"ftp", # ftp client protocol
|
||||||
"apt2ftp", # mv archives to DF
|
"apt2ftp", # mv archives to DF
|
||||||
"ftp2apt", # install DF with apt-get
|
"ftp2apt", # install DF with apt-get
|
||||||
"Packages=s", # Packages file
|
"Packages=s", # Packages file
|
||||||
"Release_only", # grab Release files only
|
"Release_only", # grab Release files only
|
||||||
"version", # program version
|
"version", # program version
|
||||||
"history", # swim history
|
"history", # swim history
|
||||||
"h", # ""
|
"h", # ""
|
||||||
"testmenu", # tmp test for menuindex.deb
|
"testmenu", # tmp test for menuindex.deb
|
||||||
"help" # it better
|
"help" # it better
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
command();
|
command();
|
||||||
@ -201,84 +209,100 @@ command();
|
|||||||
sub command {
|
sub command {
|
||||||
|
|
||||||
|
|
||||||
# test
|
# test
|
||||||
if ($commands{"testmenu"}) {
|
if ($commands{"testmenu"}) {
|
||||||
menuindex();
|
menuindex();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Turn on pager for everything, -t value is usefull, since we don't
|
|
||||||
# want the pager working if the output is short. In situations where -t
|
|
||||||
# isn't prompted for, -t shouldn't be used, pretty beta.
|
|
||||||
# The best way is to read the output into a variable than use the pager.
|
|
||||||
# This can be done simply.
|
|
||||||
# if ($commands{"t"}) {
|
|
||||||
# open(STDOUT, "|$pager");
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
if ($#ARGV == -1 && !defined %commands){
|
if ($#ARGV == -1 && !defined %commands){
|
||||||
if ($Getopt::Long::error != 1) {
|
if ($Getopt::Long::error != 1) {
|
||||||
pager(usage());
|
pager(usage());
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif (($commands{"n"} || $commands{"nopager"}) &&
|
elsif (($commands{"n"} || $commands{"nopager"}) &&
|
||||||
$#ARGV == -1 && !($commands{"q"} || $commands{"ps"} ||
|
$#ARGV == -1 && !($commands{"q"} ||
|
||||||
$commands{"research"} || $commands{"refinesearch"} ||
|
$commands{"ps"} ||
|
||||||
$commands{"powersearch"} || $commands{"search"} ||
|
$commands{"research"} ||
|
||||||
$commands{"ramdiskon"} || $commands{"ramdiskoff"} ||
|
$commands{"refinesearch"} ||
|
||||||
$commands{"help"})) {
|
$commands{"powersearch"} ||
|
||||||
print nusage() if !($commands{"history"} || $commands{"h"});
|
$commands{"search"} ||
|
||||||
exit if !($commands{"history"} || $commands{"h"});
|
$commands{"ramdiskon"} ||
|
||||||
|
$commands{"ramdiskoff"} ||
|
||||||
|
$commands{"help"})) {
|
||||||
|
|
||||||
|
print nusage() if !($commands{"history"} || $commands{"h"});
|
||||||
|
exit if !($commands{"history"} || $commands{"h"});
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif (!($commands{"n"} || $commands{"nopager"}) && $commands{"help"}
|
elsif (!($commands{"n"} || $commands{"nopager"}) &&
|
||||||
&& $#ARGV == -1 && !($commands{"q"} || $commands{"ps"} ||
|
$commands{"help"} &&
|
||||||
$commands{"research"} || $commands{"refinesearch"} ||
|
$#ARGV == -1 &&
|
||||||
$commands{"powersearch"} || $commands{"search"} ||
|
!($commands{"q"} ||
|
||||||
$commands{"ramdiskon"} || $commands{"ramdiskoff"})) {
|
$commands{"ps"} ||
|
||||||
pager(help()) if !($commands{"history"} || $commands{"h"});
|
$commands{"research"} ||
|
||||||
exit if !($commands{"history"} || $commands{"h"});
|
$commands{"refinesearch"} ||
|
||||||
|
$commands{"powersearch"} ||
|
||||||
|
$commands{"search"} ||
|
||||||
|
$commands{"ramdiskon"} ||
|
||||||
|
$commands{"ramdiskoff"})) {
|
||||||
|
|
||||||
|
pager(help()) if !($commands{"history"} || $commands{"h"});
|
||||||
|
exit if !($commands{"history"} || $commands{"h"});
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif ((($commands{"n"} || $commands{"nopager"}) && $commands{"help"})
|
elsif ((($commands{"n"} || $commands{"nopager"}) &&
|
||||||
&& $#ARGV == -1 && !($commands{"q"} || $commands{"ps"} ||
|
$commands{"help"})
|
||||||
$commands{"research"} || $commands{"refinesearch"} ||
|
&& $#ARGV == -1 &&
|
||||||
$commands{"powersearch"} || $commands{"search"} ||
|
!($commands{"q"} ||
|
||||||
$commands{"ramdiskon"} || $commands{"ramdiskoff"})) {
|
$commands{"ps"} ||
|
||||||
print help() if !($commands{"history"} || $commands{"h"});
|
$commands{"research"} ||
|
||||||
exit if !($commands{"history"} || $commands{"h"});
|
$commands{"refinesearch"} ||
|
||||||
|
$commands{"powersearch"} ||
|
||||||
|
$commands{"search"} ||
|
||||||
|
$commands{"ramdiskon"} ||
|
||||||
|
$commands{"ramdiskoff"})) {
|
||||||
|
|
||||||
|
print help() if !($commands{"history"} || $commands{"h"});
|
||||||
|
exit if !($commands{"history"} || $commands{"h"});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# version of the program
|
# version of the program
|
||||||
if ($commands{"version"}) {
|
if ($commands{"version"}) {
|
||||||
print "SWIM version $swim_version\n";
|
print "SWIM version $swim_version\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Do the the dpkg -C thing, nice no need for a separate approach
|
# Do the the dpkg -C thing, nice no need for a separate approach
|
||||||
if (($commands{"C"} || $commands{"audit"} || $commands{"status"}) &&
|
if (($commands{"C"} || $commands{"audit"} || $commands{"status"}) &&
|
||||||
defined $dpkg) {
|
defined $dpkg) {
|
||||||
|
|
||||||
system "$dpkg", "-C";
|
system "$dpkg", "-C";
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# apt administration
|
# apt administration
|
||||||
if ($commands{"apt"}) {
|
if ($commands{"apt"}) {
|
||||||
if (defined $apt_get) {
|
if (defined $apt_get) {
|
||||||
my @amount = keys %commands;
|
my @amount = keys %commands;
|
||||||
if ($#amount == 0) {
|
if ($#amount == 0) {
|
||||||
print "swim: no options given for --apt\n";
|
print "swim: no options given for --apt\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
require SWIM::Apt;
|
require SWIM::Apt;
|
||||||
SWIM::Apt->import(qw(apt));
|
SWIM::Apt->import(qw(apt));
|
||||||
apt($apt_get,$sources,\%commands);
|
apt($apt_get,$sources,\%commands);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print "swim: operation requires apt\n";
|
print "swim: operation requires apt\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -288,237 +312,277 @@ sub command {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elsif ($commands{"md5sum"} &&
|
elsif ($commands{"md5sum"} &&
|
||||||
!($commands{"l"} || $commands{"d"} || $commands{"c"} ||
|
!($commands{"l"} || $commands{"d"} || $commands{"c"} ||
|
||||||
$commands{"p"}) && ($commands{"q"} || $commands{"query"})) {
|
$commands{"p"}) && ($commands{"q"} || $commands{"query"})) {
|
||||||
print "swim: --md5sum of queries must be used with -l, -d, -c, or -p\n";
|
print "swim: --md5sum of queries must be used with -l, -d, -c, or -p\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Some error testing for major mode. Will handle all.
|
# Some error testing for major mode. Will handle all.
|
||||||
if (($commands{"initdb"} && $commands{"rebuilddb"}) ||
|
if (($commands{"initdb"} && $commands{"rebuilddb"}) ||
|
||||||
($commands{"initdb"} && $commands{"db"}) ||
|
($commands{"initdb"} && $commands{"db"}) ||
|
||||||
($commands{"db"} && $commands{"rebuilddb"}) ||
|
($commands{"db"} && $commands{"rebuilddb"}) ||
|
||||||
($commands{"initdb"} && $commands{"db"}) ||
|
($commands{"initdb"} && $commands{"db"}) ||
|
||||||
($commands{"initdb"} && $commands{"rebuilddb"} && $commands{"db"})) {
|
($commands{"initdb"} && $commands{"rebuilddb"} && $commands{"db"})) {
|
||||||
print "swim: only one major mode may be specified\n";
|
print "swim: only one major mode may be specified\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
|
||||||
|
|
||||||
# this will handle options with arguments
|
|
||||||
if ($Getopt::Long::error == 1 || $commands{"root"} || $commands{"dbpath"}) {
|
|
||||||
# If two options are used
|
|
||||||
if ($Getopt::Long::error == 1) {
|
|
||||||
if ($commands{"dbpath"} && !$commands{"root"}) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
elsif (!$commands{"dbpath"} && $commands{"root"}) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# this will handle options with arguments
|
||||||
|
if ($Getopt::Long::error == 1 || $commands{"root"} ||
|
||||||
|
$commands{"dbpath"}) {
|
||||||
|
# If two options are used
|
||||||
|
if ($Getopt::Long::error == 1) {
|
||||||
|
if ($commands{"dbpath"} && !$commands{"root"}) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
elsif (!$commands{"dbpath"} && $commands{"root"}) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Check whether a different filesystem is being used with --root
|
# Check whether a different filesystem is being used with --root
|
||||||
my($arch, $dist) = which_archdist(\%commands);
|
my($arch, $dist) = which_archdist(\%commands);
|
||||||
if ($commands{"root"} && !$commands{"dbpath"}) {
|
if ($commands{"root"} &&
|
||||||
if ($commands{"q"} || $commands{"query"} || $commands{"search"} ||
|
!$commands{"dbpath"}) {
|
||||||
$commands{"refinesearch"} || $commands{"research"} ||
|
if ($commands{"q"} ||
|
||||||
$commands{"powersearch"} || $commands{"ps"} ||
|
$commands{"query"} ||
|
||||||
$commands{"ramdiskon"} || $commands{"history"} ||
|
$commands{"search"} ||
|
||||||
$commands{"h"}) {
|
$commands{"refinesearch"} ||
|
||||||
if ($commands{"root"} =~ m,^\/.*,) {
|
$commands{"research"} ||
|
||||||
$parent = $commands{"root"};
|
$commands{"powersearch"} ||
|
||||||
my $root;
|
$commands{"ps"} ||
|
||||||
if (!($commands{"n"} || $commands{"initndb"} ||
|
$commands{"ramdiskon"} ||
|
||||||
$commands{"rebuildndb"} || $commands{"p"} ||
|
$commands{"history"} ||
|
||||||
$commands{"ndb"})) {
|
$commands{"h"}) {
|
||||||
$root = "$parent$base/packages.deb";
|
if ($commands{"root"} =~ m,^\/.*,) {
|
||||||
}
|
$parent = $commands{"root"};
|
||||||
else {
|
my $root;
|
||||||
$root = "$parent$base/npackages$arch$dist.deb";
|
if (!($commands{"n"} ||
|
||||||
}
|
$commands{"initndb"} ||
|
||||||
if (!-e $root && !-f $root) {
|
$commands{"rebuildndb"} ||
|
||||||
print "failed to open $root\n\n";
|
$commands{"p"} ||
|
||||||
exit;
|
$commands{"ndb"})) {
|
||||||
}
|
$root = "$parent$base/packages.deb";
|
||||||
}
|
}
|
||||||
elsif ($commands{"root"} ne "") {
|
else {
|
||||||
print "swim: arguments to --root must begin with a /\n";
|
$root = "$parent$base/npackages$arch$dist.deb";
|
||||||
exit;
|
}
|
||||||
}
|
if (!-e $root && !-f $root) {
|
||||||
}
|
print "failed to open $root\n\n";
|
||||||
else {
|
exit;
|
||||||
if ($commands{"initdb"} || $commands{"rebuilddb"} ||
|
}
|
||||||
$commands{"db"} || $commands{"initndb"} || $commands{"ndb"} ||
|
}
|
||||||
$commands{"rebuildndb"} || $commands{"rebuildflatdb"} ||
|
elsif ($commands{"root"} ne "") {
|
||||||
$commands{"rebuildflatndb"}) {
|
print "swim: arguments to --root must begin with a /\n";
|
||||||
if ($commands{"root"} =~ m,^\/.*,) {
|
exit;
|
||||||
$parent = $commands{"root"};
|
}
|
||||||
my $root = "$parent$base";
|
}
|
||||||
if (!-e $root && !-f $root) {
|
else {
|
||||||
print "failed to open $root\n\n";
|
if ($commands{"initdb"} ||
|
||||||
exit;
|
$commands{"rebuilddb"} ||
|
||||||
}
|
$commands{"db"} ||
|
||||||
}
|
$commands{"initndb"} ||
|
||||||
elsif ($commands{"root"} ne "") {
|
$commands{"ndb"} ||
|
||||||
print "swim: arguments to --root must begin with a /\n";
|
$commands{"rebuildndb"} ||
|
||||||
exit;
|
$commands{"rebuildflatdb"} ||
|
||||||
}
|
$commands{"rebuildflatndb"}) {
|
||||||
}
|
if ($commands{"root"} =~ m,^\/.*,) {
|
||||||
else {
|
$parent = $commands{"root"};
|
||||||
print "swim: --root may only be specified during querying, and database rebuilds\n";
|
my $root = "$parent$base";
|
||||||
exit;
|
if (!-e $root && !-f $root) {
|
||||||
}
|
print "failed to open $root\n\n";
|
||||||
}
|
exit;
|
||||||
}
|
}
|
||||||
# check whether a different database location is being used with --dbpath.
|
}
|
||||||
elsif ($commands{"dbpath"} && !$commands{"root"}) {
|
elsif ($commands{"root"} ne "") {
|
||||||
if ($commands{"q"} || $commands{"query"} || $commands{"search"} ||
|
print "swim: arguments to --root must begin with a /\n";
|
||||||
$commands{"refinesearch"} || $commands{"research"} ||
|
exit;
|
||||||
$commands{"powersearch"} || $commands{"ps"} ||
|
}
|
||||||
$commands{"ramdiskon"} || $commands{"history"} ||
|
}
|
||||||
$commands{"h"}) {
|
else {
|
||||||
if ($commands{"dbpath"} =~ m,^\/.*,) {
|
print "swim: --root may only be specified during querying, and database rebuilds\n";
|
||||||
my $dbpath;
|
exit;
|
||||||
$library = $commands{"dbpath"};
|
}
|
||||||
if (!($commands{"n"} || $commands{"initndb"} ||
|
}
|
||||||
$commands{"rebuildndb"} ||
|
}
|
||||||
$commands{"p"} || $commands{"ndb"})) {
|
# check whether a different database location is being used with --dbpath.
|
||||||
$dbpath = "$library/packages.deb";
|
elsif ($commands{"dbpath"} &&
|
||||||
}
|
!$commands{"root"}) {
|
||||||
else {
|
if ($commands{"q"} ||
|
||||||
$dbpath = "$library/npackages$arch$dist.deb";
|
$commands{"query"} ||
|
||||||
}
|
$commands{"search"} ||
|
||||||
if (!-e $dbpath && !-f $dbpath) {
|
$commands{"refinesearch"} ||
|
||||||
print "failed to open $dbpath\n\n";
|
$commands{"research"} ||
|
||||||
exit;
|
$commands{"powersearch"} ||
|
||||||
}
|
$commands{"ps"} ||
|
||||||
}
|
$commands{"ramdiskon"} ||
|
||||||
elsif ($commands{"dbpath"} ne "") {
|
$commands{"history"} ||
|
||||||
print "swim: arguments to --dbpath must begin with a /\n";
|
$commands{"h"}) {
|
||||||
exit;
|
if ($commands{"dbpath"} =~ m,^\/.*,) {
|
||||||
}
|
my $dbpath;
|
||||||
}
|
$library = $commands{"dbpath"};
|
||||||
else {
|
if (!($commands{"n"} ||
|
||||||
if ($commands{"dbpath"} !~ m,^\/,) {
|
$commands{"initndb"} ||
|
||||||
print "swim: arguments to --dbpath must begin with a /\n";
|
$commands{"rebuildndb"} ||
|
||||||
}
|
$commands{"p"} ||
|
||||||
else {
|
$commands{"ndb"})) {
|
||||||
if ($commands{"initdb"} || $commands{"rebuilddb"} ||
|
$dbpath = "$library/packages.deb";
|
||||||
$commands{"db"} || $commands{"rebuildndb"} ||
|
}
|
||||||
$commands{"initndb"} || $commands{"rebuildflatdb"}
|
else {
|
||||||
|| $commands{"ndb"} || $commands{"rebuildflatndb"}) {
|
$dbpath = "$library/npackages$arch$dist.deb";
|
||||||
if ($commands{"dbpath"} =~ m,^\/.*,) {
|
}
|
||||||
$library = $commands{"dbpath"};
|
if (!-e $dbpath && !-f $dbpath) {
|
||||||
my $dbpath = "$library";
|
print "failed to open $dbpath\n\n";
|
||||||
if (!-e $dbpath && !-f $dbpath) {
|
exit;
|
||||||
print "failed to open $dbpath\n\n";
|
}
|
||||||
exit;
|
}
|
||||||
}
|
elsif ($commands{"dbpath"} ne "") {
|
||||||
}
|
print "swim: arguments to --dbpath must begin with a /\n";
|
||||||
elsif ($commands{"dbpath"} ne "") {
|
exit;
|
||||||
print "swim: arguments to --dbpath must begin with a /\n";
|
}
|
||||||
exit;
|
}
|
||||||
}
|
else {
|
||||||
}
|
if ($commands{"dbpath"} !~ m,^\/,) {
|
||||||
else {
|
print "swim: arguments to --dbpath must begin with a /\n";
|
||||||
print "swim: --dbpath given for operation that does not use a database\n";
|
}
|
||||||
exit;
|
else {
|
||||||
}
|
if ($commands{"initdb"} ||
|
||||||
}
|
$commands{"rebuilddb"} ||
|
||||||
}
|
$commands{"db"} ||
|
||||||
}
|
$commands{"rebuildndb"} ||
|
||||||
# check whether a different database location is being used with --dbpath
|
$commands{"initndb"} ||
|
||||||
# and --root / are being used, dbpath takes priority but uses --root as
|
$commands{"rebuildflatdb"} ||
|
||||||
# the base.
|
$commands{"ndb"} ||
|
||||||
elsif ($commands{"dbpath"} && $commands{"root"}) {
|
$commands{"rebuildflatndb"}) {
|
||||||
if ($commands{"q"} || $commands{"query"} || $commands{"search"} ||
|
if ($commands{"dbpath"} =~ m,^\/.*,) {
|
||||||
$commands{"refinesearch"} || $commands{"research"} ||
|
$library = $commands{"dbpath"};
|
||||||
$commands{"powersearch"} || $commands{"ps"} ||
|
my $dbpath = "$library";
|
||||||
$commands{"ramdiskon"} || $commands{"history"} ||
|
if (!-e $dbpath && !-f $dbpath) {
|
||||||
$commands{"h"}) {
|
print "failed to open $dbpath\n\n";
|
||||||
if ($commands{"dbpath"} =~ m,^\/.*, &&
|
exit;
|
||||||
$commands{"root"} =~ m,^\/.*,) {
|
}
|
||||||
$parent = $commands{"root"};
|
}
|
||||||
$library = $commands{"dbpath"};
|
elsif ($commands{"dbpath"} ne "") {
|
||||||
my $root = "$parent$library";
|
print "swim: arguments to --dbpath must begin with a /\n";
|
||||||
my $dbpath;
|
exit;
|
||||||
if (!($commands{"n"} || $commands{"initndb"} ||
|
}
|
||||||
$commands{"rebuildndb"} || $commands{"p"} ||
|
}
|
||||||
$commands{"ndb"})) {
|
else {
|
||||||
$dbpath = "$parent$library/packages.deb";
|
print "swim: --dbpath given for operation that does not use a database\n";
|
||||||
}
|
exit;
|
||||||
else {
|
}
|
||||||
$dbpath = "$parent$library/npackages$arch$dist.deb";
|
}
|
||||||
}
|
}
|
||||||
if (!-e $dbpath && !-f $dbpath) {
|
}
|
||||||
print "failed to open $dbpath\n\n";
|
# check whether a different database location is being used with
|
||||||
exit;
|
# --dbpath
|
||||||
}
|
# and --root / are being used, dbpath takes priority but uses --root as
|
||||||
if (!-e $root && !-f $root) {
|
# the base.
|
||||||
print "failed to open $root\n\n";
|
elsif ($commands{"dbpath"} && $commands{"root"}) {
|
||||||
exit;
|
if ($commands{"q"} ||
|
||||||
}
|
$commands{"query"} ||
|
||||||
}
|
$commands{"search"} ||
|
||||||
elsif ($commands{"dbpath"} ne "") {
|
$commands{"refinesearch"} ||
|
||||||
print "swim: arguments to --dbpath must begin with a /\n";
|
$commands{"research"} ||
|
||||||
exit;
|
$commands{"powersearch"} ||
|
||||||
}
|
$commands{"ps"} ||
|
||||||
}
|
$commands{"ramdiskon"} ||
|
||||||
else {
|
$commands{"history"} ||
|
||||||
if ($commands{"dbpath"} !~ m,^\/,) {
|
$commands{"h"}) {
|
||||||
print "swim: arguments to --dbpath must begin with a /\n";
|
if ($commands{"dbpath"} =~ m,^\/.*, &&
|
||||||
exit;
|
$commands{"root"} =~ m,^\/.*,) {
|
||||||
}
|
$parent = $commands{"root"};
|
||||||
if ($commands{"initdb"} || $commands{"rebuilddb"} ||
|
$library = $commands{"dbpath"};
|
||||||
$commands{"db"} || $commands{"initndb"} || $commands{"ndb"} ||
|
my $root = "$parent$library";
|
||||||
$commands{"rebuildndb"} || $commands{"rebuildflatdb"} ||
|
my $dbpath;
|
||||||
$commands{"rebuildflatndb"}) {
|
if (!($commands{"n"} ||
|
||||||
if ($commands{"dbpath"} =~ m,^\/.*, &&
|
$commands{"initndb"} ||
|
||||||
$commands{"root"} =~ m,^\/.*,) {
|
$commands{"rebuildndb"} ||
|
||||||
$parent = $commands{"root"};
|
$commands{"p"} ||
|
||||||
$library = $commands{"dbpath"};
|
$commands{"ndb"})) {
|
||||||
my $root = "$parent$library";
|
$dbpath = "$parent$library/packages.deb";
|
||||||
my $dbpath = "$parent$library";
|
}
|
||||||
if (!-e $dbpath && !-f $dbpath) {
|
else {
|
||||||
print "failed to open $dbpath\n\n";
|
$dbpath = "$parent$library/npackages$arch$dist.deb";
|
||||||
exit;
|
}
|
||||||
}
|
if (!-e $dbpath && !-f $dbpath) {
|
||||||
if (!-e $root && !-f $root) {
|
print "failed to open $dbpath\n\n";
|
||||||
print "failed to open $root\n\n";
|
exit;
|
||||||
exit;
|
}
|
||||||
}
|
if (!-e $root && !-f $root) {
|
||||||
}
|
print "failed to open $root\n\n";
|
||||||
elsif ($commands{"dbpath"} ne "") {
|
exit;
|
||||||
print "swim: arguments to --dbpath must begin with a /\n";
|
}
|
||||||
exit;
|
}
|
||||||
}
|
elsif ($commands{"dbpath"} ne "") {
|
||||||
}
|
print "swim: arguments to --dbpath must begin with a /\n";
|
||||||
else {
|
exit;
|
||||||
print "\nswim: --dbpath given for operation that does not use a database\n";
|
}
|
||||||
exit;
|
}
|
||||||
}
|
else {
|
||||||
}
|
if ($commands{"dbpath"} !~ m,^\/,) {
|
||||||
}
|
print "swim: arguments to --dbpath must begin with a /\n";
|
||||||
# final monster ... but, really only as a trap.
|
exit;
|
||||||
elsif ($commands{"root"}) {
|
}
|
||||||
exit;
|
if ($commands{"initdb"} ||
|
||||||
}
|
$commands{"rebuilddb"} ||
|
||||||
elsif ($commands{"dbpath"}) {
|
$commands{"db"} ||
|
||||||
exit;
|
$commands{"initndb"} ||
|
||||||
}
|
$commands{"ndb"} ||
|
||||||
} # end if (Getopt
|
$commands{"rebuildndb"} ||
|
||||||
|
$commands{"rebuildflatdb"} ||
|
||||||
|
$commands{"rebuildflatndb"}) {
|
||||||
|
if ($commands{"dbpath"} =~ m,^\/.*, &&
|
||||||
|
$commands{"root"} =~ m,^\/.*,) {
|
||||||
|
$parent = $commands{"root"};
|
||||||
|
$library = $commands{"dbpath"};
|
||||||
|
my $root = "$parent$library";
|
||||||
|
my $dbpath = "$parent$library";
|
||||||
|
if (!-e $dbpath && !-f $dbpath) {
|
||||||
|
print "failed to open $dbpath\n\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if (!-e $root && !-f $root) {
|
||||||
|
print "failed to open $root\n\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($commands{"dbpath"} ne "") {
|
||||||
|
print "swim: arguments to --dbpath must begin with a /\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "\nswim: --dbpath given for operation that does not use a database\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# final monster ... but, really only as a trap.
|
||||||
|
elsif ($commands{"root"}) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
elsif ($commands{"dbpath"}) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} # end if (Getopt
|
||||||
|
|
||||||
|
|
||||||
# need Package(s) and Contents file(s) --ftp
|
# need Package(s) and Contents file(s) --ftp
|
||||||
if ($commands{"ftp"} && !($commands{"q"} ||
|
if ($commands{"ftp"} &&
|
||||||
$commands{"search"} || $commands{"powersearch"} ||
|
!($commands{"q"} ||
|
||||||
$commands{"ps"} || $commands{"research"} ||
|
$commands{"search"} ||
|
||||||
$commands{"refinesearch"})) {
|
$commands{"powersearch"} ||
|
||||||
require SWIM::Apt;
|
$commands{"ps"} ||
|
||||||
SWIM::Apt->import(qw(ftp));
|
$commands{"research"} ||
|
||||||
ftp(\%commands);
|
$commands{"refinesearch"})) {
|
||||||
exit;
|
require SWIM::Apt;
|
||||||
}
|
SWIM::Apt->import(qw(ftp));
|
||||||
|
ftp(\%commands);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# make things a lot faster
|
# make things a lot faster
|
||||||
|
Loading…
x
Reference in New Issue
Block a user