* 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:
Eelco Dolstra 2008-05-09 09:32:31 +00:00
parent 98748a319a
commit 728a278641

View file

@ -61,26 +61,31 @@ mount --bind /sys $mountPoint/sys
# Grub needs a mtab. Make a proper one..
chroot $mountPoint \
/nix/var/nix/profiles/system/sw/bin/cat /proc/mounts > /etc/mtab
/nix/var/nix/profiles/system/sw/bin/cat /proc/mounts > /etc/mtab
echo "/etc/mtab: "
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