[Fai-commit] r4485 - trunk/bin
lange at alioth.debian.org
lange at alioth.debian.org
Wed Aug 8 20:36:34 UTC 2007
Author: lange
Date: 2007-08-08 20:36:34 +0000 (Wed, 08 Aug 2007)
New Revision: 4485
Modified:
trunk/bin/install_packages
Log:
add option -H, put suffix -internal to all internal commands
Modified: trunk/bin/install_packages
===================================================================
--- trunk/bin/install_packages 2007-08-05 19:34:47 UTC (rev 4484)
+++ trunk/bin/install_packages 2007-08-08 20:36:34 UTC (rev 4485)
@@ -25,7 +25,7 @@
# MA 02111-1307, USA.
#*********************************************************************
-my $version = "Version 4.1, 4-aug-2007";
+my $version = "Version 4.1.1, 8-aug-2007";
$0=~ s#.+/##; # remove path from program name
# import variables: $verbose, $MAXPACKAGES, $classes, $FAI, $FAI_ROOT
@@ -34,7 +34,7 @@
use Getopt::Std;
# global variables
-our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_m,$opt_n,$opt_N,$opt_p);
+our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_H,$opt_m,$opt_n,$opt_N,$opt_p);
my $listonly; # flag, that indicates that only a list of packages will be printed
our @commands;
our %command;
@@ -66,8 +66,7 @@
# order of commands to execute
my $aptopt='-y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"';
-
- at commands = qw/y2i y2r yast rpmr urpmi urpme yumgroup yumi yumr smarti smartr hold taskrm taskinst clean aptitude aptitude-r install unpack remove dselect-upgrade/;
+ at commands = qw/y2i y2r yast rpmr urpmi urpme yumgroup yumi yumr smarti smartr hold taskrm taskinst clean-internal aptitude aptitude-r install unpack remove dselect-upgrade/;
%command = (
"install" => "apt-get $aptopt --fix-missing install",
"inst-internal" => "apt-get $aptopt --fix-missing -s install",
@@ -76,13 +75,13 @@
"taskinst" => "tasksel -n install",
"taskrm" => "tasksel -n remove",
"hold" => "dpkg --set-selections",
- "clean" => "apt-get clean",
+ "clean-internal" => "apt-get clean",
"aptitude" => "aptitude -R $aptopt install",
"aptitude-r" => "aptitude -r $aptopt install",
"unpack" => "cd $downloaddir; aptitude download",
"unpack-internal" => "dpkg --unpack --recursive $downloaddir; rm $downloaddir/*.deb",
- "pending" => "dpkg --configure --pending",
- "dpkgc" => "dpkg -C",
+ "pending-internal" => "dpkg --configure --pending",
+ "dpkgc-internal" => "dpkg -C",
"urpmi" => "urpmi --auto --foce --allow-force --keep",
"urpme" => "urpme --auto --foce --allow-force --keep",
"yumi" => "yum -y install",
@@ -94,16 +93,17 @@
"rpmr" => "rpm -e",
smarti => "smart install -y",
smartr => "smart remove -y",
- smartc => "smart clean",
+ "smartc-internal" => "smart clean",
);
-getopts('dhvlLm:p:nN');
+getopts('dhHvlLm:p:nN');
my $use_aptpkg=0;
$opt_N || check_aptpkg(); # do not use AptPkg when -N is given
$listonly = $opt_l || $opt_L;
$opt_h && usage();
+$opt_H && showcommands();
$verbose=$ENV{verbose} || $opt_v;
$opt_d && setdownloadonly();
$maxpl=$ENV{MAXPACKAGES} || $opt_m ;
@@ -139,9 +139,9 @@
foreach my $dt (@debiantypes) {
$types{$dt} and $hasdebian=1;
if ($types{$dt} eq 'smarti') {
- $command{clean} = $command{smartc};
- $command{pending} = "true";
- $command{dpkgc} = "true";
+ $command{'clean-internal'} = $command{'smartc-internal'};
+ $command{'pending-internal'} = "true";
+ $command{'dpkgc-internal'} = "true";
}
}
@@ -162,8 +162,8 @@
# call apt-get or tasksel for each type of command whith the list of packages
foreach $atype (@commands) {
- if ($atype eq "clean" && $hasdebian) {
- execute("$rootcmd $command{clean}") unless $listonly;
+ if ($atype eq "clean-internal" && $hasdebian) {
+ execute("$rootcmd $command{'clean-internal'}") unless $listonly;
next;
}
@@ -201,7 +201,7 @@
my $shortlist = join(' ', splice @known,0,$maxpl);
# print "SL $shortlist\n";
execute("$rootcmd $command{$atype} $shortlist") if $shortlist;
- execute("$rootcmd $command{'clean'}") if $hasdebian;
+ execute("$rootcmd $command{'clean-internal'}") if $hasdebian;
execute("$rootcmd $command{'unpack-internal'}") if ($atype eq "unpack"); # unpack and rm deb files
}
next;
@@ -233,11 +233,11 @@
if ($hasdebian) {
# in case of unconfigured packages because of apt errors
# retry configuration
- execute("$rootcmd $command{pending}");
+ execute("$rootcmd $command{'pending-internal'}");
# check if all went right
- execute("$rootcmd $command{dpkgc}");
+ execute("$rootcmd $command{'dpkgc-internal'}");
# clean apt cache
- execute("$rootcmd $command{clean}");
+ execute("$rootcmd $command{'clean-internal'}");
}
if ($execerrors) {
@@ -469,9 +469,9 @@
"aptitude" => "aptitude -R -d $ENV{aptoptions} -y install $devnull",
"aptitude-r" => "aptitude -r -d $ENV{aptoptions} -y install $devnull",
"unpack" => "cd $downloaddir; aptitude download",
- "clean" => 'true',
- "pending" => 'true',
- "dpkgc" => 'true',
+ "clean-internal" => 'true',
+ "pending-internal" => 'true',
+ "dpkgc-internal" => 'true',
);
}
@@ -492,3 +492,21 @@
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub showcommands {
+
+ # show all available commands
+ print "List of known commands for package_config files\n";
+ print "Short list:\n";
+ foreach (sort keys %command) {
+ next if /-internal/; # skip internal commands
+ print "$_\n";
+ }
+
+ print "\nLong list:\n";
+ foreach (sort keys %command) {
+ next if /-internal/; # skip internal commands
+ printf "%15s $command{$_}\n",$_;
+ }
+ exit 0;
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - -
More information about the Fai-commit
mailing list