diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-08-25 10:07:31 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-08-25 10:07:31 +0000 |
commit | 65b74104e773b7140a91775e7456dc12d64797ab (patch) | |
tree | 5eb692f7a3352a24085cb337ea2985564fa897ae /tools | |
parent | c59cc6576d077f8fae92d7330d5341b001c8de50 (diff) | |
download | drakx-65b74104e773b7140a91775e7456dc12d64797ab.tar drakx-65b74104e773b7140a91775e7456dc12d64797ab.tar.gz drakx-65b74104e773b7140a91775e7456dc12d64797ab.tar.bz2 drakx-65b74104e773b7140a91775e7456dc12d64797ab.tar.xz drakx-65b74104e773b7140a91775e7456dc12d64797ab.zip |
- allow to easy clean existing chroot
- more fuzzy detection of mounted loop (to "losetup -d" it)
- better log message for loop
Diffstat (limited to 'tools')
-rw-r--r-- | tools/drakx-in-chroot | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot index 91f9edd28..fe54207b7 100644 --- a/tools/drakx-in-chroot +++ b/tools/drakx-in-chroot @@ -29,6 +29,7 @@ if (-d $SLASH_LOCATION) { umount_all() == 0 or die "$SLASH_LOCATION is busy\n"; sys("$sudo rm -rf $SLASH_LOCATION/var/lib/rpm $SLASH_LOCATION/dev/mapper"); rm_rf($SLASH_LOCATION); + rm_rf(glob("$dir/*")) if $ENV{CLEAN}; } mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/dev/usb', '/etc', '/var', '/proc', $STAGE2_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED, $prefix_ROOTED; @@ -79,7 +80,7 @@ sub find_free_loop() { foreach (0..255) { my $dev = "/dev/loop$_"; system("$sudo losetup $dev >/dev/null 2>&1") != 0 or next; - warn "found $dev\n"; + warn "found free loop $dev\n"; return $dev; } die "no free loop found"; @@ -114,7 +115,7 @@ sub umount_all() { system_verbose "$sudo umount $dir 2>/dev/null"; next; } - my ($loop) = cat_('/proc/mounts') =~ m!^(/dev/loop\d+) \Q$dir\E !m; + my ($loop) = cat_('/proc/mounts') =~ m!^(/dev/loop\d+) .*\Q$dir\E !m; system_verbose "$sudo umount $dir"; sys("$sudo losetup -d $loop") if $loop; } |