diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-04-19 12:10:00 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-04-19 12:10:00 +0000 |
commit | 7f79f78d1a0af648a116cd1e39a073e051502b9c (patch) | |
tree | 8ae051619b77ff62baad7c689d6eadb68401cbcc /urpmi.addmedia | |
parent | f2afab2525937a0a6e3028b78ea1763696ac7cee (diff) | |
download | urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar.gz urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar.bz2 urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar.xz urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.zip |
Some more options refactorisation. The --from option of urpmi.addmedia
was being ignored; fix it.
Diffstat (limited to 'urpmi.addmedia')
-rwxr-xr-x | urpmi.addmedia | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/urpmi.addmedia b/urpmi.addmedia index 803dca8c..8157db01 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -22,7 +22,7 @@ use strict; use urpm; -use urpm::args; +use urpm::args 'options'; use urpm::msg; # Default mirror list @@ -79,16 +79,19 @@ and [options] are from } sub main { - our %options; #- parse /etc/urpmi/mirror.config if present, or use default mandrake mirror. - if (-e "/etc/urpmi/mirror.config") { - local (*F, $_); - open F, "/etc/urpmi/mirror.config"; - while (<F>) { + # the --from option overrides this setting. + if ($options{mirrors_url}) { + $mirrors = $options{$mirrors_url}; + } + elsif (-e "/etc/urpmi/mirror.config") { + local $_; + open my $fh, "/etc/urpmi/mirror.config"; + while (<$fh>) { chomp; s/#.*$//; s/^\s*//; s/\s*$//; /^url\s*=\s*(.*)/ and $mirrors = $1; } - close F; + close $fh; } $options{force} = 0; $options{noclean} = 1; @@ -111,7 +114,6 @@ sub main { #- -h always set, updates should allow setting update flag. $options{distrib} eq 'updates' and $options{update} = 1; #- official site by default. - $options{from} ||= $mirrors; #- get default value unless already provided. unless ($options{version} && $options{arch}) { my $db = URPM::DB::open; |