diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-01-28 18:09:52 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-01-28 18:09:52 +0000 |
commit | cd3fd7727010115a3c1cbac2b5ca11c3a81a02a1 (patch) | |
tree | 38de8e4fc3966937d4f7982b92b7c9bc3ec80cde /urpm | |
parent | c64b39c89a0b13a78a7ff97f8fcbd26916e3ccfb (diff) | |
download | urpmi-cd3fd7727010115a3c1cbac2b5ca11c3a81a02a1.tar urpmi-cd3fd7727010115a3c1cbac2b5ca11c3a81a02a1.tar.gz urpmi-cd3fd7727010115a3c1cbac2b5ca11c3a81a02a1.tar.bz2 urpmi-cd3fd7727010115a3c1cbac2b5ca11c3a81a02a1.tar.xz urpmi-cd3fd7727010115a3c1cbac2b5ca11c3a81a02a1.zip |
Make urpmi support ISO images as removable media.
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/sys.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm index 1ccc3b6e..8a5e0739 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -107,6 +107,26 @@ sub find_mntpoints { @mntpoints; } +#- returns the first unused loop device, or an empty string if none is found. +sub first_free_loopdev () { + open my $mounts, '/proc/mounts' or do { warn "Can't read /proc/mounts: $!\n"; return 1 }; + my %loopdevs = map { $_ => 1 } grep { ! -d $_ } glob('/dev/loop*'); + local *_; + while (<$mounts>) { + (our $dev) = split ' '; + delete $loopdevs{$dev} if $dev =~ m!^/dev/loop!; + } + close $mounts; + my @l = keys %loopdevs; + @l ? $l[0] : ''; +} + +sub trim_until_d { + my ($dir) = @_; + while ($dir && !-d $dir) { $dir =~ s,/[^/]*$,, } + $dir; +} + #- checks if the main filesystems are writeable for urpmi to install files in sub check_fs_writable () { open my $mounts, '/proc/mounts' or do { warn "Can't read /proc/mounts: $!\n"; return 1 }; |