summaryrefslogtreecommitdiffstats
path: root/urpm/removable.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-26 19:49:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-26 19:49:24 +0000
commit3b2fed1bc06a87b95ce8592198bb1a4864677235 (patch)
treeced15270d0204ee482e6638c59524579600a12ea /urpm/removable.pm
parent21716fdd4df2d5dfc6bacadf116f9ffcea8f2dfa (diff)
downloadurpmi-3b2fed1bc06a87b95ce8592198bb1a4864677235.tar
urpmi-3b2fed1bc06a87b95ce8592198bb1a4864677235.tar.gz
urpmi-3b2fed1bc06a87b95ce8592198bb1a4864677235.tar.bz2
urpmi-3b2fed1bc06a87b95ce8592198bb1a4864677235.tar.xz
urpmi-3b2fed1bc06a87b95ce8592198bb1a4864677235.zip
create _examine_removable_medium_ out of _examine_removable_medium
Diffstat (limited to 'urpm/removable.pm')
-rw-r--r--urpm/removable.pm25
1 files changed, 17 insertions, 8 deletions
diff --git a/urpm/removable.pm b/urpm/removable.pm
index 111e36fa..dd00490f 100644
--- a/urpm/removable.pm
+++ b/urpm/removable.pm
@@ -104,12 +104,25 @@ sub _check_notfound {
sub _examine_removable_medium {
my ($urpm, $list, $sources, $id, $device, $o_ask_for_medium) = @_;
- my $medium = $urpm->{media}[$id];
- if (my $dir = file_from_local_url($medium->{url})) {
+ my $medium = $urpm->{media}[$id];
+
+ if (file_from_local_url($medium->{url})) {
+ _examine_removable_medium_($urpm, $medium, $list->[$id], $sources, $device, $o_ask_for_medium);
+ } else {
+ #- we have a removable device that is not removable, well...
+ $urpm->{error}(N("inconsistent medium \"%s\" marked removable but not really", $medium->{name}));
+ }
+}
+
+sub _examine_removable_medium_ {
+ my ($urpm, $medium, $medium_list, $sources, $device, $o_ask_for_medium) = @_;
+
+ my $dir = file_from_local_url($medium->{url});
+
#- the directory given does not exist and may be accessible
#- by mounting some other directory. Try to figure it out and mount
#- everything that might be necessary.
- while (_check_notfound($urpm, $list->[$id], $dir, is_iso($medium->{removable}) ? $medium->{removable} : 'removable')) {
+ while (_check_notfound($urpm, $medium_list, $dir, is_iso($medium->{removable}) ? $medium->{removable} : 'removable')) {
is_iso($medium->{removable}) || $o_ask_for_medium
or $urpm->{fatal}(4, N("medium \"%s\" is not available", $medium->{name}));
try_umounting($urpm, $dir);
@@ -119,7 +132,7 @@ sub _examine_removable_medium {
or $urpm->{fatal}(4, N("medium \"%s\" is not available", $medium->{name}));
}
if (-e $dir) {
- while (my ($i, $url) = each %{$list->[$id]}) {
+ while (my ($i, $url) = each %$medium_list) {
chomp $url;
my $filepath = file_from_local_url($url) or next;
$filepath =~ m!/.*/! or next; #- is this really needed??
@@ -148,10 +161,6 @@ sub _examine_removable_medium {
} else {
$urpm->{error}(N("medium \"%s\" is not available", $medium->{name}));
}
- } else {
- #- we have a removable device that is not removable, well...
- $urpm->{error}(N("inconsistent medium \"%s\" marked removable but not really", $medium->{name}));
- }
}
sub _get_removables_or_check_mounted {