diff options
-rwxr-xr-x | urpmi.removemedia | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/urpmi.removemedia b/urpmi.removemedia index 5019796a..76d53296 100755 --- a/urpmi.removemedia +++ b/urpmi.removemedia @@ -77,16 +77,15 @@ urpm::download::set_cmdline_proxy(); my @entries = map { $_->{name} } @{$urpm->{media}}; if ($options{all}) { - @toremove = @entries; - @toremove == 0 and die N("nothing to remove (use urpmi.addmedia to add a media)\n"); + @toremove = @entries or die N("nothing to remove (use urpmi.addmedia to add a media)\n"); +} else { + @toremove or die N("the entry to remove is missing\n(one of %s)\n", join(", ", @entries)); } -@toremove == 0 and die N("the entry to remove is missing\n(one of %s)\n", join(", ", @entries)); $urpm->select_media({ strict_match => $options{strict_match} }, @toremove); -my $selected = 0; -foreach (@{$urpm->{media}}) { - if ($_->{modified}) { $selected = 1; last } -} + +my $selected = grep { $_->{modified} } @{$urpm->{media}}; + $urpm->remove_selected_media; $urpm->update_media(noclean => $options{noclean}); |