[Fai-commit] r4428 - trunk/bin
lange at alioth.debian.org
lange at alioth.debian.org
Wed Jul 11 19:46:23 UTC 2007
Author: lange
Date: 2007-07-11 19:46:23 +0000 (Wed, 11 Jul 2007)
New Revision: 4428
Modified:
trunk/bin/install_packages
Log:
add option -n, move code to check_aptpkg()
Modified: trunk/bin/install_packages
===================================================================
--- trunk/bin/install_packages 2007-07-11 19:30:47 UTC (rev 4427)
+++ trunk/bin/install_packages 2007-07-11 19:46:23 UTC (rev 4428)
@@ -33,25 +33,8 @@
use strict;
use Getopt::Std;
-# check if the Perl module is available
-my $use_aptpkg=0;
-my $_config;
-my $_system;
-if (eval "require AptPkg::Config") {
- $use_aptpkg=1;
- eval "require AptPkg::System";
- eval "require AptPkg::Cache";
-
- $_config = $AptPkg::Config::_config;
- $_system = $AptPkg::System::_system;
- eval 'import AptPkg::Config $_config';
- eval 'import AptPkg::System $_system';
- eval 'import AptPkg::Cache';
-}
-
-
# global variables
-our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_t,$opt_m,$opt_p);
+our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_t,$opt_m,$opt_n,$opt_p);
my $listonly; # flag, that indicates that only a list of packages will be printed
our @commands;
our %command;
@@ -64,6 +47,8 @@
my $rootcmd;
my @preloadlist;
my @preloadrmlist;
+my $_config;
+my $_system;
my %list; # hash of arrays, key=type (yumi,aptitude,..), list of packages
my %types; # hash containing the types found in all loaded package_config files
my %classisdef;
@@ -108,8 +93,11 @@
);
$test = 0;
-getopts('dthvlLm:p:');
+getopts('dthvlLm:p:n');
+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_t and $test = 1;
@@ -457,3 +445,19 @@
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub check_aptpkg {
+
+ # check if the Perl module is available
+ if (eval "require AptPkg::Config") {
+ $use_aptpkg=1;
+ eval "require AptPkg::System";
+ eval "require AptPkg::Cache";
+
+ $_config = $AptPkg::Config::_config;
+ $_system = $AptPkg::System::_system;
+ eval 'import AptPkg::Config $_config';
+ eval 'import AptPkg::System $_system';
+ eval 'import AptPkg::Cache';
+ }
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - -
More information about the Fai-commit
mailing list