diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-02-26 21:02:17 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-02-26 21:02:17 +0000 |
commit | 5f8f3f148428f10ba2f177038715e195f627ee1b (patch) | |
tree | 977e61a2a983182e88419f2ce44b51cd477d4fc0 | |
parent | 17aae3de9b3c922ec422db55747d34fe88c15f2f (diff) | |
download | urpmi-5f8f3f148428f10ba2f177038715e195f627ee1b.tar urpmi-5f8f3f148428f10ba2f177038715e195f627ee1b.tar.gz urpmi-5f8f3f148428f10ba2f177038715e195f627ee1b.tar.bz2 urpmi-5f8f3f148428f10ba2f177038715e195f627ee1b.tar.xz urpmi-5f8f3f148428f10ba2f177038715e195f627ee1b.zip |
create _non_mounted_mntpoints() to make things more clear
-rw-r--r-- | urpm/removable.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/urpm/removable.pm b/urpm/removable.pm index c94e5eeb..e119f103 100644 --- a/urpm/removable.pm +++ b/urpm/removable.pm @@ -21,16 +21,15 @@ sub is_iso { #- side-effects: $urpm->{removable_mounted}, mount sub try_mounting { my ($urpm, $dir, $o_removable) = @_; - my %infos; my $is_iso = is_iso($o_removable); my @mntpoints = $is_iso #- note: for isos, we don't parse the fstab because it might not be declared in it. #- so we try to remove suffixes from the dir name until the dir exists ? ($dir = urpm::sys::trim_until_d($dir)) - : urpm::sys::find_mntpoints($dir = reduce_pathname($dir), \%infos); + : _non_mounted_mntpoints($dir = reduce_pathname($dir)); - foreach (grep { ! $infos{$_}{mounted} } @mntpoints) { + foreach (@mntpoints) { $urpm->{log}(N("mounting %s", $_)); if ($is_iso) { #- to mount an iso image, grab the first loop device @@ -66,6 +65,12 @@ sub _mounted_mntpoints { my %infos; grep { $infos{$_}{mounted} } urpm::sys::find_mntpoints($dir, \%infos); } +#- side-effects: none +sub _non_mounted_mntpoints { + my ($dir) = @_; + my %infos; + grep { !$infos{$_}{mounted} } urpm::sys::find_mntpoints($dir, \%infos); +} #- side-effects: $urpm->{removable_mounted} #- + those of try_umounting ($urpm->{removable_mounted}, umount) |