summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-09 16:00:44 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-09 16:00:44 +0000
commitf89651ff189e4b5e3331217816400e49b5a4f59c (patch)
tree1c5dfc4a1532f29048b72291178045db2f1800d9
parent5d7f39c9464491d362938e0204ffd53d95834713 (diff)
downloadurpmi-f89651ff189e4b5e3331217816400e49b5a4f59c.tar
urpmi-f89651ff189e4b5e3331217816400e49b5a4f59c.tar.gz
urpmi-f89651ff189e4b5e3331217816400e49b5a4f59c.tar.bz2
urpmi-f89651ff189e4b5e3331217816400e49b5a4f59c.tar.xz
urpmi-f89651ff189e4b5e3331217816400e49b5a4f59c.zip
simplify
-rwxr-xr-xurpmi.removemedia13
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});