Remount already mounted filesystems.

This was modified by William Hubbs to use the checkpath helper and to
improve readability.

Signed-off-by: William Hubbs <williamh@gentoo.org>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
(tested with genkernel /usr mount changes);
This commit is contained in:
Piotr Karbowski 2012-02-03 21:17:18 +01:00 committed by Robin H. Johnson
parent 0fcc6251fc
commit 497ff7ee41

View File

@ -13,20 +13,40 @@ depend()
start() start()
{ {
case ",$(fstabinfo -o /)," in case ",$(fstabinfo -o /)," in
*,ro,*) return 0;; *,ro,*)
esac ;;
*)
if echo 2>/dev/null >/.test.$$; then # Check if the rootfs isn't already writable.
rm -f /.test.$$ /fastboot /forcefsck if checkpath -W /; then
return 0 rm -f /fastboot /forcefsck
fi else
ebegin "Remounting root filesystem read/write" ebegin "Remounting root filesystem read/write"
case "$RC_UNAME" in case "$RC_UNAME" in
Linux) mount -n -o remount,rw /;; Linux)
*) mount -u -o rw /;; mount -n -o remount,rw /
;;
*)
mount -u -o rw /
;;
esac esac
if eend $? "Root filesystem could not be mounted read/write"; then eend $? "Root filesystem could not be mounted read/write"
if [ $? -eq 0 ]; then
rm -f /fastboot /forcefsck rm -f /fastboot /forcefsck
fi fi
fi
;;
esac
ebegin "Remounting filesystems"
local mountpoint
for mountpoint in $(fstabinfo); do
case "${mountpoint}" in
/)
;;
/*)
mountinfo -q "${mountpoint}" && fstabinfo --remount "${mountpoint}"
;;
esac
done
eend 0
} }