Hi Joey, hi everyone, i also need to specify an alternative configuration file to debmirror because i need to mirror Debian and Ubuntu on the same host. The attached patch adds the command line switch "--config-file=".
Now i run debmirror like this: debmirror --config-file=/etc/debmirror-ubuntu.conf debmirror --config-file=/etc/debmirror-debian.conf Please review the patch and include if it is fine. best wishes, Matthias
From 7a4f928a0c221e9a8003440cd57216d6bafcdfea Mon Sep 17 00:00:00 2001 From: Matthias Schmitz <matth...@sigxcpu.org> Date: Mon, 25 Jun 2012 10:32:01 +0200 Subject: [PATCH] Add switch to specify configuration file at command line. * Add command line switch --config-file= to allow specification of alternate configuration file. --- debmirror | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/debmirror b/debmirror index ccb4fbd..9f6d687 100755 --- a/debmirror +++ b/debmirror @@ -575,14 +575,11 @@ our $debmarshal=0; our $slow_cpu=0; our $check_gpg=1; our $new_mirror=0; +our $config_file=undef; my @errlog; my $HOME; ($HOME = $ENV{'HOME'}) or die "HOME not defined in environment!\n"; -# Load in config files -require "/etc/debmirror.conf" if -r "/etc/debmirror.conf"; -require "$HOME/.debmirror.conf" if -r "$HOME/.debmirror.conf"; - # This hash contains the releases to mirror. If both codename and suite can be # determined from the Release file, the codename is used in the key. If not, # it can also be a suite (or whatever was requested by the user). @@ -674,10 +671,24 @@ GetOptions('debug' => \$debug, 'debmarshal' => \$debmarshal, 'slow-cpu' => \$slow_cpu, 'help' => \$help, + 'config-file=s' => \$config_file, ) or usage; usage if $help; usage("invalid number of arguments") if $ARGV[1]; +# Load in config files +if ( defined $config_file ) { + if ( -r $config_file ) { + require $config_file; + } else { + die "Cannot open config file $config_file."; + } +} else { + require "/etc/debmirror.conf" if -r "/etc/debmirror.conf"; + require "$HOME/.debmirror.conf" if -r "$HOME/.debmirror.conf"; +} + + # This parameter is so important that it is the only required parameter, # unless specified in a configuration file. $mirrordir = shift if $ARGV[0]; -- 1.7.10
signature.asc
Description: PGP signature