summaryrefslogtreecommitdiffstats
path: root/tools/drakx-in-chroot
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2015-03-05 19:13:47 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2015-03-05 21:37:02 +0100
commit8e0356cbefac53f4b95e02563d16ced41aeeba7b (patch)
tree9250a7325021dc8c87f883a97582e4de3fc01830 /tools/drakx-in-chroot
parentf666184dd26169a6950a44a7e28de4bb0ade251b (diff)
downloaddrakx-8e0356cbefac53f4b95e02563d16ced41aeeba7b.tar
drakx-8e0356cbefac53f4b95e02563d16ced41aeeba7b.tar.gz
drakx-8e0356cbefac53f4b95e02563d16ced41aeeba7b.tar.bz2
drakx-8e0356cbefac53f4b95e02563d16ced41aeeba7b.tar.xz
drakx-8e0356cbefac53f4b95e02563d16ced41aeeba7b.zip
unbreak !draklive case
with previous commit, running drakx-in-chroot a 2nd time fails b/c /tmp/drakx-in-chroot/dev would still exists (we first copy a couple files in it then mount --bind the real /dev on top)
Diffstat (limited to 'tools/drakx-in-chroot')
-rwxr-xr-xtools/drakx-in-chroot9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index 784258980..d5c10a088 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -62,7 +62,7 @@ my $_b = before_leaving { sys("$sudo umount $_") foreach reverse @mounts };
undef $ENV{TMPDIR}; # prevent packdrake faillure on creating temporary files
if (-d $SLASH_LOCATION) {
- umount_all() == 0 or exit(1);
+ umount_all(1) == 0 or exit(1);
sys("$sudo rm -rf $SLASH_LOCATION/var/lib/rpm $SLASH_LOCATION/dev/mapper");
rm_rf($SLASH_LOCATION);
}
@@ -213,10 +213,15 @@ sub create_initial_devices() {
sys("$sudo cp -a /dev/{mem,null,random,urandom,tty} $SLASH_LOCATION/dev");
}
-sub umount_all() {
+sub umount_all {
+ my ($b_umount_dev_too) = @_;
my $err;
clean_stage2_updates();
my @procs = (qw(/proc /sys/kernel/debug /sys /run/udev /run/blkid /run/initramfs /run));
+ # special case for !draklive case (else a 2nd run would fail):
+ if ($b_umount_dev_too && cat_('/proc/mounts') =~ m! $SLASH_LOCATION/dev !) {
+ system_verbose "$sudo umount $SLASH_LOCATION/dev" and rm_rf("$SLASH_LOCATION/dev");
+ }
foreach ((map { "$prefix_ROOTED$_" } @procs, '/dev', ''), @procs, $STAGE2_LOCATION_ROOTED, $LOOP_MOUNT_POINT, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
my $dir = "$SLASH_LOCATION$_";
rmdir $dir;