summaryrefslogtreecommitdiffstats
path: root/urpm/removable.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-26 22:42:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-26 22:42:19 +0000
commit41b7546359f0df8adebacf0443f867f67ef20273 (patch)
treef8bc9d7b647e32ca8a856b46f5479875693c9cb6 /urpm/removable.pm
parent01a70edbe99b55ebb91210c68fae5767bcc2a8f3 (diff)
downloadurpmi-41b7546359f0df8adebacf0443f867f67ef20273.tar
urpmi-41b7546359f0df8adebacf0443f867f67ef20273.tar.gz
urpmi-41b7546359f0df8adebacf0443f867f67ef20273.tar.bz2
urpmi-41b7546359f0df8adebacf0443f867f67ef20273.tar.xz
urpmi-41b7546359f0df8adebacf0443f867f67ef20273.zip
split _get_removables_or_check_mounted into _try_mounting_non_removable and _get_removables
Diffstat (limited to 'urpm/removable.pm')
-rw-r--r--urpm/removable.pm24
1 files changed, 17 insertions, 7 deletions
diff --git a/urpm/removable.pm b/urpm/removable.pm
index 97b15a39..345ba127 100644
--- a/urpm/removable.pm
+++ b/urpm/removable.pm
@@ -205,8 +205,20 @@ sub _examine_removable_medium_ {
#- side-effects:
#- + those of try_mounting ($urpm->{removable_mounted}, "mount")
-sub _get_removables_or_check_mounted {
- my ($urpm, $blists) = @_;
+sub _try_mounting_non_removable {
+ my ($urpm, $media) = @_;
+
+ foreach my $medium (grep { !$_->{removable} } @$media) {
+ my $dir = file_from_local_url($medium->{url}) or next;
+
+ -e $dir || try_mounting($urpm, $dir) or
+ $urpm->{error}(N("unable to access medium \"%s\"", $medium->{name})), next;
+ }
+}
+
+#- side-effects: none
+sub _get_removables {
+ my ($blists) = @_;
my %removables;
@@ -216,9 +228,6 @@ sub _get_removables_or_check_mounted {
if (my $device = $medium->{removable}) {
next if $device =~ m![^a-zA-Z0-9_./-]!; #- bad path
push @{$removables{$device} ||= []}, $_;
- } elsif (my $dir = file_from_local_url($medium->{url})) {
- -e $dir || try_mounting($urpm, $dir) or
- $urpm->{error}(N("unable to access medium \"%s\"", $medium->{name})), next;
}
}
values %removables;
@@ -256,14 +265,15 @@ sub _sort_media {
#- where there is one hash for each medium in {media}
#-
#- side-effects:
-#- + those of _get_removables_or_check_mounted ($urpm->{removable_mounted}, "mount")
#- + those of _examine_removable_medium ($urpm->{removable_mounted}, $sources, "mount", "umount", "eject", "copy-move-files")
sub copy_packages_of_removable_media {
my ($urpm, $list, $sources, $o_ask_for_medium) = @_;
my $blists = _create_blists($urpm->{media}, $list);
- foreach my $l (_get_removables_or_check_mounted($urpm, $blists)) {
+ _try_mounting_non_removable($urpm, $urpm->{media});
+
+ foreach my $l (_get_removables($blists)) {
#- Here we have only removable devices.
#- If more than one media uses this device, we have to sort