From 04cdfc93220a8deb595dccda794fa34ae5c77f36 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 21 Mar 2013 07:28:16 +0000 Subject: simplify, let mount finds the loop device --- urpm/removable.pm | 4 +--- urpm/sys.pm | 17 ----------------- 2 files changed, 1 insertion(+), 20 deletions(-) (limited to 'urpm') diff --git a/urpm/removable.pm b/urpm/removable.pm index 7da3d687..ced637bb 100644 --- a/urpm/removable.pm +++ b/urpm/removable.pm @@ -85,10 +85,8 @@ sub _try_mounting_iso { if ($mntpoint) { $urpm->{log}(N("mounting %s", $mntpoint)); - #- to mount an iso image, grab the first loop device - my $loopdev = urpm::sys::first_free_loopdev(); sys_log("mount iso $mntpoint on $iso"); - $loopdev and system('mount', $iso, $mntpoint, '-t', 'iso9660', '-o', "loop=$loopdev"); + system('mount', $iso, $mntpoint, '-t', 'iso9660', '-o', 'loop'); $urpm->{removable_mounted}{$mntpoint} = undef; } -e $mntpoint; diff --git a/urpm/sys.pm b/urpm/sys.pm index c056af73..bfe0e719 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -162,23 +162,6 @@ sub proc_mounts() { @l; } - -=item first_free_loopdev() - -Returns the first unused loop device, or an empty string if none is found. - -=cut - -sub first_free_loopdev () { - my %loopdevs = map { $_ => 1 } grep { ! -d $_ } glob('/dev/loop*'); - foreach (proc_mounts()) { - (our $dev) = split ' '; - delete $loopdevs{$dev} if $dev =~ m!^/dev/loop!; - } - my @l = keys %loopdevs; - @l ? $l[0] : ''; -} - sub trim_until_d { my ($dir) = @_; foreach (proc_mounts()) { -- cgit v1.2.1