forked from josch/mmdebstrap
only unmount device nodes and directories with --no-mtab in unshare mode
This commit is contained in:
parent
594a37d093
commit
ac8084cb42
1 changed files with 10 additions and 2 deletions
|
@ -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}) {
|
||||
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
|
||||
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: $!";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue