summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}});