mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 01:16:57 +01:00
* Unmount only the filesystems that the installer actually mounted.
So if the user mounted /mnt/boot or something, don't unmount it. svn path=/nixos/trunk/; revision=11792
This commit is contained in:
parent
98748a319a
commit
728a278641
1 changed files with 13 additions and 8 deletions
|
@ -69,18 +69,23 @@ cat /mnt/etc/mtab
|
|||
# That could spoil mtab with litter.
|
||||
mount --rbind / $mountPoint/mnt
|
||||
|
||||
cleanup() {
|
||||
# !!! don't umount anything we didn't mount ourselves
|
||||
for i in $(grep -F "$mountPoint" /proc/mounts \
|
||||
umountUnder() {
|
||||
local dir="$1"
|
||||
for i in $(grep -F " $dir" /proc/mounts \
|
||||
| @perl@/bin/perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \
|
||||
| sort -r);
|
||||
do
|
||||
if test "$i" != "$mountPoint" -a "$i" != / -a -e "$i"; then
|
||||
umount $i || true
|
||||
fi
|
||||
umount $i || true
|
||||
done
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
umountUnder $mountPoint/mnt
|
||||
umountUnder $mountPoint/dev
|
||||
umountUnder $mountPoint/proc
|
||||
umountUnder $mountPoint/sys
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
|
||||
mkdir -m 01777 -p $mountPoint/tmp
|
||||
|
|
Loading…
Reference in a new issue