diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-02-26 22:37:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-02-26 22:37:00 +0000 |
commit | e3c7a9fca9087dbf613803444c03cdefd3ec263b (patch) | |
tree | 8c33d378ee2adb990e80aa357521eae56d0c6cf2 /urpm | |
parent | 616a68c09a7038e721c547a2158e32e9b33802de (diff) | |
download | urpmi-e3c7a9fca9087dbf613803444c03cdefd3ec263b.tar urpmi-e3c7a9fca9087dbf613803444c03cdefd3ec263b.tar.gz urpmi-e3c7a9fca9087dbf613803444c03cdefd3ec263b.tar.bz2 urpmi-e3c7a9fca9087dbf613803444c03cdefd3ec263b.tar.xz urpmi-e3c7a9fca9087dbf613803444c03cdefd3ec263b.zip |
_check_notfound should be pure, there is no reason for _sort_media should
mount any removable media. so introducing _mount_and_check_notfound()
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/removable.pm | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/urpm/removable.pm b/urpm/removable.pm index e0a5543b..7b3bee2f 100644 --- a/urpm/removable.pm +++ b/urpm/removable.pm @@ -83,25 +83,26 @@ sub try_umounting_removables { delete $urpm->{removable_mounted}; } -#- examine if given medium is already inside a removable device. -#- #- side-effects: #- + those of try_mounting ($urpm->{removable_mounted}, "mount") -sub _check_notfound { +sub _mount_and_check_notfound { my ($urpm, $medium_list, $dir, $removable) = @_; - if ($dir) { - try_mounting($urpm, $dir, $removable); - -e $dir or return 2; - } - foreach (values %$medium_list) { - my $dir_ = _filepath($_) or next; - if (!$dir) { - $dir = $dir_; - try_mounting($urpm, $dir, $removable); - } - -r $dir_ or return 1; - } - 0; + + try_mounting($urpm, $dir, $removable); + -e $dir or return 2; + + _check_notfound($urpm, $medium_list); +} + +#- side-effects: none +sub _check_notfound { + my ($urpm, $medium_list) = @_; + + foreach (values %$medium_list) { + my $dir_ = _filepath($_) or next; + -r $dir_ or return 1; + } + 0; } #- removable media have to be examined to keep mounted the one that has @@ -123,7 +124,7 @@ sub _examine_removable_medium { } #- side-effects: "eject" -#- + those of _check_notfound ($urpm->{removable_mounted}, "mount") +#- + those of _mount_and_check_notfound ($urpm->{removable_mounted}, "mount") #- + those of try_umounting ($urpm->{removable_mounted}, "umount") sub _mount_it { my ($urpm, $medium, $medium_list, $o_ask_for_medium) = @_; @@ -133,7 +134,7 @@ sub _mount_it { #- 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, $medium_list, $dir, $medium->{removable})) { + while (_mount_and_check_notfound($urpm, $medium_list, $dir, $medium->{removable})) { if (is_iso($medium->{removable})) { try_umounting($urpm, $dir); } else { |