diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-04-11 14:00:19 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-04-11 14:00:19 +0000 |
commit | eac41d32643794eaf3ea6f1717b538b024067697 (patch) | |
tree | e0b0bf0c5893ff15084348b01bc746695b30b0be | |
parent | 356f6e4dd452ff11017aa2466ea4aa2324306012 (diff) | |
download | urpmi-eac41d32643794eaf3ea6f1717b538b024067697.tar urpmi-eac41d32643794eaf3ea6f1717b538b024067697.tar.gz urpmi-eac41d32643794eaf3ea6f1717b538b024067697.tar.bz2 urpmi-eac41d32643794eaf3ea6f1717b538b024067697.tar.xz urpmi-eac41d32643794eaf3ea6f1717b538b024067697.zip |
Add a --raw option to urpmi.addmedia
-rw-r--r-- | man/C/urpmi.addmedia.8 | 4 | ||||
-rw-r--r-- | urpm/args.pm | 3 | ||||
-rwxr-xr-x | urpmi.addmedia | 33 |
3 files changed, 28 insertions, 12 deletions
diff --git a/man/C/urpmi.addmedia.8 b/man/C/urpmi.addmedia.8 index 24d66929..377cb820 100644 --- a/man/C/urpmi.addmedia.8 +++ b/man/C/urpmi.addmedia.8 @@ -113,6 +113,10 @@ and so it does not need to be updated by \fBurpmi.update\fP. .IP "\fB\--norebuild\fP" Don't try to rebuild the hdlist files from the RPMs if the original hdlist wasn't readable or was corrupted. +.IP "\fB\--raw\fP" +Add the new media in the urpmi configuration file, but don't update it nor +proceed to any download. The media, to be usable, will need to be updated with +\fBurpmi.update\fP. .IP "\fB\-c\fP" Clean headers cache directory in /var/cache/urpmi/headers. .IP "\fB\-h\fP" diff --git a/urpm/args.pm b/urpm/args.pm index ffd1c426..9cbc8073 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -251,7 +251,7 @@ my %options_spec = ( 'force-key' => \$options{forcekey}, 'limit-rate=s' => \$options{limit_rate}, 'no-md5sum' => \$options{nomd5sum}, - 'noa|d' => \my $dummy, # default, keeped for compatibility + 'noa|d' => \my $dummy, #- default, kept for compatibility 'q|quiet' => sub { --$options{verbose} }, 'v|verbose' => sub { ++$options{verbose} }, 'norebuild!' => sub { $urpm->{options}{norebuild} = $_[1]; $options{force} = 0 }, @@ -269,6 +269,7 @@ my %options_spec = ( virtual => \$options{virtual}, 'q|quiet' => sub { --$options{verbose} }, 'v|verbose' => sub { ++$options{verbose} }, + raw => \$options{raw}, '<>' => sub { push @::cmdline, $_[0]; }, diff --git a/urpmi.addmedia b/urpmi.addmedia index df54a7a6..e4bc7ffc 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -68,6 +68,7 @@ and [options] are from only file:// protocol is allowed. ") . N(" --no-md5sum - disable MD5SUM file checking. ") . N(" --norebuild - don't try to rebuild hdlist if not readable. +") . N(" --raw - add the media in config, but don't update it. ") . N(" -c - clean headers cache directory. ") . N(" -f - force generation of hdlist files. ") . N(" -q - quiet mode. @@ -134,19 +135,27 @@ sub main { $options{probe_with} || $with eq "with" or usage N("`with' missing for network media\n"); } - $urpm->add_medium($name, $url, $relative_hdlist, virtual => $options{virtual}, update => $options{update}); + $urpm->add_medium( + $name, $url, $relative_hdlist, + virtual => $options{virtual}, + update => $options{update}, + no_reload_config => $options{raw}, + ); urpm::download::copy_cmd_line_proxy($name); - $urpm->update_media(%options, callback => \&urpm::download::sync_logger); - - #- check creation of media (during update has been successfull) - my ($medium) = grep { $_->{name} eq $name } @{$urpm->{media}}; - $medium or die N("unable to create medium \"%s\"\n", $name); - if ($medium->{modified}) { - print STDERR N("unable to update medium \"%s\"\n", $name); - #- remove quietly the failing media. - $urpm->{log} = sub {}; - $urpm->remove_selected_media; + if ($options{raw}) { + $urpm->write_config(); + } else { $urpm->update_media(%options, callback => \&urpm::download::sync_logger); + #- check creation of media + my ($medium) = grep { $_->{name} eq $name } @{$urpm->{media}}; + $medium or die N("unable to create medium \"%s\"\n", $name); + if ($medium->{modified}) { + print STDERR N("unable to update medium \"%s\"\n", $name); + #- remove quietly the failing media. + $urpm->{log} = sub {}; + $urpm->remove_selected_media; + $urpm->update_media(%options, callback => \&urpm::download::sync_logger); + } } } @@ -155,3 +164,5 @@ sub main { } main(); + +=for vim:ts=8:sts=4:sw=4 |