aboutsummaryrefslogtreecommitdiff
path: root/init.d/localmount.in
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2012-11-29 10:19:20 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2012-11-29 10:19:20 -0600
commit5cce37837b89145832c75b310791ae3a69d883ec (patch)
tree73170c37071961c293a795e405ed62f0784834cc /init.d/localmount.in
parent0a72893c8b02e70a51e7ee0148a3fe586a82cd9d (diff)
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
Diffstat (limited to 'init.d/localmount.in')
-rw-r--r--init.d/localmount.in8
1 files changed, 7 insertions, 1 deletions
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)$"