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
This commit is contained in:
parent
0a72893c8b
commit
5cce37837b
@ -22,6 +22,9 @@ start()
|
|||||||
|
|
||||||
if [ "$RC_UNAME" = Linux ]; then
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
no_netdev="-O no_netdev"
|
no_netdev="-O no_netdev"
|
||||||
|
if [ mountinfo -q /usr ]; then
|
||||||
|
touch $rc_svcdir/usr_premounted
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
ebegin "Mounting local filesystems"
|
ebegin "Mounting local filesystems"
|
||||||
mount -at "$types" $no_netdev
|
mount -at "$types" $no_netdev
|
||||||
@ -48,7 +51,10 @@ stop()
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "$RC_UNAME" = Linux ]; then
|
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
|
fi
|
||||||
no_umounts_r="^($no_umounts_r)$"
|
no_umounts_r="^($no_umounts_r)$"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user