summaryrefslogtreecommitdiffstats
path: root/urpmi.addmedia
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.com>2006-06-12 09:43:54 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.com>2006-06-12 09:43:54 +0000
commitbf7ba492507bebb59b15a6f39c9e8c8433fb983d (patch)
tree910b41f451fd2fef58e6402c95e96c74bfa2ed5f /urpmi.addmedia
parente611acef4e04ec5a84a967fef1da4d48a7d0bbb9 (diff)
downloadurpmi-bf7ba492507bebb59b15a6f39c9e8c8433fb983d.tar
urpmi-bf7ba492507bebb59b15a6f39c9e8c8433fb983d.tar.gz
urpmi-bf7ba492507bebb59b15a6f39c9e8c8433fb983d.tar.bz2
urpmi-bf7ba492507bebb59b15a6f39c9e8c8433fb983d.tar.xz
urpmi-bf7ba492507bebb59b15a6f39c9e8c8433fb983d.zip
Make options --interactive and --all-media independent in urpmi.addmedia.
Plus spelling fixes.
Diffstat (limited to 'urpmi.addmedia')
-rwxr-xr-xurpmi.addmedia33
1 files changed, 18 insertions, 15 deletions
diff --git a/urpmi.addmedia b/urpmi.addmedia
index dec67346..bed458f3 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -56,8 +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(" --interactive - with --distrib, ask confirmation for each media
+") . N(" --all-media - with --distrib, add every listed media
") . 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,
@@ -125,18 +125,21 @@ 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;
-
+ my $add_media_callback = $options{interactive} ?
+ sub {
+ my ($medianame, $add_by_default) = @_;
+ my $yesexpr = N("Yy");
+ $add_by_default = 1 if $options{allmedia};
+ my $answer = message_input(
+ N("\nDo you want to add media '%s'", $medianame) . ($add_by_default ? N(" (Y/n) ") : N(" (y/N) ")),
+ undef,
+ boolean => 1,
+ );
+ return $answer ? $answer =~ /[$yesexpr]/ : $add_by_default;
+ } : $options{allmedia} ? sub {
+ 1;
+ } : undef;
+
$urpm->add_distrib_media(
$name,
$url,
@@ -144,7 +147,7 @@ if ($options{distrib}) {
update => $options{update},
probe_with => $options{probe_with},
nolock => $options{nolock},
- ask_media => $add_media_callback,
+ ask_media => $add_media_callback,
);
local $SIG{INT} = sub {
remove_failed($urpm, grep { $_->{modified} } @{$urpm->{media}});