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
|
@ -61,26 +61,31 @@ mount --bind /sys $mountPoint/sys
|
||||||
|
|
||||||
# Grub needs a mtab. Make a proper one..
|
# Grub needs a mtab. Make a proper one..
|
||||||
chroot $mountPoint \
|
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: "
|
echo "/etc/mtab: "
|
||||||
cat /mnt/etc/mtab
|
cat /mnt/etc/mtab
|
||||||
|
|
||||||
# That could spoil mtab with litter.
|
# That could spoil mtab with litter.
|
||||||
mount --rbind / $mountPoint/mnt
|
mount --rbind / $mountPoint/mnt
|
||||||
|
|
||||||
cleanup() {
|
umountUnder() {
|
||||||
# !!! don't umount anything we didn't mount ourselves
|
local dir="$1"
|
||||||
for i in $(grep -F "$mountPoint" /proc/mounts \
|
for i in $(grep -F " $dir" /proc/mounts \
|
||||||
| @perl@/bin/perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \
|
| @perl@/bin/perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \
|
||||||
| sort -r);
|
| sort -r);
|
||||||
do
|
do
|
||||||
if test "$i" != "$mountPoint" -a "$i" != / -a -e "$i"; then
|
umount $i || true
|
||||||
umount $i || true
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
umountUnder $mountPoint/mnt
|
||||||
|
umountUnder $mountPoint/dev
|
||||||
|
umountUnder $mountPoint/proc
|
||||||
|
umountUnder $mountPoint/sys
|
||||||
|
}
|
||||||
|
|
||||||
trap "cleanup" EXIT
|
trap "cleanup" EXIT
|
||||||
|
|
||||||
mkdir -m 01777 -p $mountPoint/tmp
|
mkdir -m 01777 -p $mountPoint/tmp
|
||||||
|
|
Loading…
Reference in a new issue