From 87589b49d1543595188dcb26aa5a09d33e5e0a4e Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sat, 22 Oct 2011 16:31:38 +0100 Subject: Do not attempt to overwrite /etc/mtab if it's a symlink (suppresses error) --- rc.d/init.d/halt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 3f6d5dac..c137d87d 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -161,9 +161,12 @@ fi [ -x /sbin/quotaoff ] && action "Turning off quotas: " /sbin/quotaoff -aug -# first remove entry /initrd/loopfs as it can't be unmounted :( -mtab=$(fgrep -v "/initrd/loopfs[^/]" /etc/mtab) -(IFS= ; echo $mtab > /etc/mtab) +# Only adjust mtab if it's not a symbolic link +if [ ! -L /etc/mtab ]; then + # first remove entry /initrd/loopfs as it can't be unmounted :( + mtab=$(fgrep -v "/initrd/loopfs[^/]" /etc/mtab) + (IFS= ; echo $mtab > /etc/mtab) +fi # Unmount file systems, killing processes if we have to. # Unmount loopback stuff first -- cgit v1.2.1