From 5cce37837b89145832c75b310791ae3a69d883ec Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Thu, 29 Nov 2012 10:19:20 -0600 Subject: localmount: only skip unmounting /usr if it was premounted Add a test when localmount is started to determine if /usr is mounted from inside an initramfs for Linux systems. If it is not, we can unmount it when localmount stops. On *bsd systems, we always unmount /usr if it is separate. Reported-by: ryao@gentoo.org --- init.d/localmount.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'init.d/localmount.in') diff --git a/init.d/localmount.in b/init.d/localmount.in index 8e67c38a..ab0b1b5c 100644 --- a/init.d/localmount.in +++ b/init.d/localmount.in @@ -22,6 +22,9 @@ start() if [ "$RC_UNAME" = Linux ]; then no_netdev="-O no_netdev" + if [ mountinfo -q /usr ]; then + touch $rc_svcdir/usr_premounted + fi fi ebegin "Mounting local filesystems" mount -at "$types" $no_netdev @@ -48,7 +51,10 @@ stop() done if [ "$RC_UNAME" = Linux ]; then - no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*|/usr" + no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*" + if [ -e $rc_svcdir/usr_premounted ]; then + no_umounts_r="$no_umounts_r|/usr" + fi fi no_umounts_r="^($no_umounts_r)$" -- cgit v1.2.3