From 32229e0c0535bd21e382b55797f4f77285ebfd03 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Fri, 9 Oct 2009 16:09:56 +0000 Subject: [PATCH] Make NixOS harder to kill on boot by leaving stale locks for mtab svn path=/nixos/trunk/; revision=17734 --- modules/system/boot/stage-2-init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index 3f76b165a27..0cc09caebba 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -27,9 +27,10 @@ setPath "@path@" # Mount special file systems. mkdir -m 0755 -p /etc test -e /etc/fstab || touch /etc/fstab # to shut up mount +[ -s /etc/mtab ] && rm /etc/mtab # while installing a symlink is created (see man mount), if it's still there for whateever reason remove it +rm -f /etc/mtab* # not that we care about stale locks mkdir -m 0755 -p /proc mount -n -t proc none /proc -[ -s /etc/mtab ] && rm /etc/mtab # while installing a symlink is created (see man mount), if it's still there for whateever reason remove it rm -f /etc/mtab cat /proc/mounts > /etc/mtab