summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2006-06-10 02:11:18 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2006-06-10 02:11:18 +0000
commit99c59fd0f670418b96b90d44a07c6cfa4cef5d66 (patch)
treeaef5b12e205ef6a0a70cb327a739180788e654ae
parent68f62051f4b03410b931b1846b1cbe3fd9e86587 (diff)
downloadurpmi-99c59fd0f670418b96b90d44a07c6cfa4cef5d66.tar
urpmi-99c59fd0f670418b96b90d44a07c6cfa4cef5d66.tar.gz
urpmi-99c59fd0f670418b96b90d44a07c6cfa4cef5d66.tar.bz2
urpmi-99c59fd0f670418b96b90d44a07c6cfa4cef5d66.tar.xz
urpmi-99c59fd0f670418b96b90d44a07c6cfa4cef5d66.zip
- make urpmi.addmedia asking media by media if they should be installed
-rw-r--r--urpm.pm15
-rwxr-xr-xurpmi.addmedia9
2 files changed, 23 insertions, 1 deletions
diff --git a/urpm.pm b/urpm.pm
index 5eb26eba..a9c673c8 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -822,16 +822,29 @@ sub add_distrib_media {
#- at this point, we have found a media.cfg file, so parse it
#- and create all necessary media according to it.
my $medium = $options{initial_number} || 1;
+ my @media_list_toadd;
+
foreach my $media ($distribconf->listmedia()) {
my $skip = 0;
- # if one of value is set, we skip the media
+ # if one of value is set, we skip the media by default
foreach (qw(suppl askmedia noauto)) {
$distribconf->getvalue($media, $_) and do {
$skip = 1;
last;
};
}
+ if ($options{ask_media}) {
+ if($options{ask_media}->(
+ $distribconf->getvalue($media, 'name'),
+ !$skip,
+ )) {
+ $skip = 0;
+ } else {
+ $skip = 1;
+ }
+ }
$skip and next;
+
my $media_name = $distribconf->getvalue($media, 'name') || '';
push @newnames, $urpm->add_medium(
diff --git a/urpmi.addmedia b/urpmi.addmedia
index 20f44298..24e8bd46 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -130,6 +130,15 @@ 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);
+ },
);
local $SIG{INT} = sub {
remove_failed($urpm, grep { $_->{modified} } @{$urpm->{media}});