From ac8084cb428be12db250a1f698a3f0e50d9026b3 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Mon, 8 Oct 2018 11:25:39 +0200 Subject: [PATCH] only unmount device nodes and directories with --no-mtab in unshare mode --- mmdebstrap | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index db59ba2..8c4e2fd 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1115,11 +1115,19 @@ sub setup { unlink "$options->{root}/$fname" or die "cannot unlink $fname: $!"; } elsif ($type == 3 or $type == 4) { # character/block special if (!$options->{havemknod}) { - 0 == system('umount', '--no-mtab', "$options->{root}/$fname") or die "umount failed: $?"; + if ($options->{mode} eq 'unshare') { + 0 == system('umount', '--no-mtab', "$options->{root}/$fname") or die "umount failed: $?"; + } else { + 0 == system('umount', "$options->{root}/$fname") or die "umount failed: $?"; + } unlink "$options->{root}/$fname"; } } elsif ($type == 5) { # directory - 0 == system('umount', '--no-mtab', "$options->{root}/$fname") or die "umount failed: $?"; + if ($options->{mode} eq 'unshare') { + 0 == system('umount', '--no-mtab', "$options->{root}/$fname") or die "umount failed: $?"; + } else { + 0 == system('umount', "$options->{root}/$fname") or die "umount failed: $?"; + } if (!$options->{havemknod}) { rmdir "$options->{root}/$fname" or die "cannot rmdir $fname: $!"; }