From 5f8f3f148428f10ba2f177038715e195f627ee1b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 26 Feb 2008 21:02:17 +0000 Subject: create _non_mounted_mntpoints() to make things more clear --- urpm/removable.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'urpm/removable.pm') 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) -- cgit v1.2.1