summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2006-06-11 18:40:45 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2006-06-11 18:40:45 +0000
commite611acef4e04ec5a84a967fef1da4d48a7d0bbb9 (patch)
tree857591b50f88084e878335bff2eaa347bcf45f39
parent1d648c332e21d8fac81b0fc442ffbaac27638902 (diff)
downloadurpmi-e611acef4e04ec5a84a967fef1da4d48a7d0bbb9.tar
urpmi-e611acef4e04ec5a84a967fef1da4d48a7d0bbb9.tar.gz
urpmi-e611acef4e04ec5a84a967fef1da4d48a7d0bbb9.tar.bz2
urpmi-e611acef4e04ec5a84a967fef1da4d48a7d0bbb9.tar.xz
urpmi-e611acef4e04ec5a84a967fef1da4d48a7d0bbb9.zip
- restore old behavior of urpmi.addmedia, add --all-media and --interactive options
-rw-r--r--urpm/args.pm2
-rwxr-xr-xurpmi.addmedia24
2 files changed, 17 insertions, 9 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index cfb7cff4..c6de5f38 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -304,6 +304,8 @@ my %options_spec = (
'probe-hdlist' => sub { $options{probe_with} = 'hdlist' },
'no-probe' => sub { $options{probe_with} = undef },
distrib => sub { $options{distrib} = 1 },
+ interactive => sub { $options{interactive} = 1 },
+ 'all-media' => sub { $options{allmedia} = 1 },
'from=s' => \$options{mirrors_url},
virtual => \$options{virtual},
nopubkey => \$options{nopubkey},
diff --git a/urpmi.addmedia b/urpmi.addmedia
index 24e8bd46..dec67346 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -56,6 +56,8 @@ and [options] are from
hdlist file.
") . N(" --distrib - automatically create all media from an installation
medium.
+") . N(" --interactive - with --distrib, ask confirmation for each media before addition
+") . N(" --all-media - with --distrib, add all medium include not automatic one
") . N(" --from - use specified url for list of mirrors, the default is
%s
", $urpm::cfg::mirrors) . N(" --virtual - create virtual media wich are always up-to-date,
@@ -123,6 +125,18 @@ if ($options{distrib}) {
$with || $relative_hdlist
and usage N("no need to give <relative path of hdlist> with --distrib");
+ my $add_media_callback = $options{interactive} || $options{allmedia} ?
+ sub {
+ my ($medianame, $default) = @_;
+ my $yesexpr = N("Yy");
+ my $answer = message_input(
+ N("\nDo you want to add media '%s'", $medianame) . ($default ? N(" (Y/n) ") : N(" (y/N) ")),
+ $options{allmedia} ? $yesexpr : undef,
+ boolean => 1
+ );
+ return($answer ? $answer =~ /[$yesexpr]/ : $default);
+ } : undef;
+
$urpm->add_distrib_media(
$name,
$url,
@@ -130,15 +144,7 @@ if ($options{distrib}) {
update => $options{update},
probe_with => $options{probe_with},
nolock => $options{nolock},
- ask_media => sub {
- my ($medianame, $default) = @_;
- my $yesexpr = N("Yy");
- my $answer = message_input(
- N("\nDo you want to add media '%s'", $medianame) . ($default ? N(" (Y/n) ") : N(" (y/N) ")),
- undef, boolean => 1
- );
- return($answer ? $answer =~ /[$yesexpr]/ : $default);
- },
+ ask_media => $add_media_callback,
);
local $SIG{INT} = sub {
remove_failed($urpm, grep { $_->{modified} } @{$urpm->{media}});