aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Karbowski <piotr.karbowski@gmail.com>2012-02-03 21:17:18 +0100
committerRobin H. Johnson <robbat2@gentoo.org>2012-02-09 07:27:56 +0000
commit497ff7ee41168d863971efb52e2ca6b42f765832 (patch)
tree1fd5779c89464fa861207c7e6753993ccb1c8eeb
parent0fcc6251fcde9c722207afa6f953aea7e80d771b (diff)
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);
-rw-r--r--init.d/root.in48
1 files changed, 34 insertions, 14 deletions
diff --git a/init.d/root.in b/init.d/root.in
index 1c937716..4d63919a 100644
--- a/init.d/root.in
+++ b/init.d/root.in
@@ -13,20 +13,40 @@ depend()
start()
{
case ",$(fstabinfo -o /)," in
- *,ro,*) return 0;;
+ *,ro,*)
+ ;;
+ *)
+ # Check if the rootfs isn't already writable.
+ if checkpath -W /; then
+ rm -f /fastboot /forcefsck
+ else
+ ebegin "Remounting root filesystem read/write"
+ case "$RC_UNAME" in
+ Linux)
+ mount -n -o remount,rw /
+ ;;
+ *)
+ mount -u -o rw /
+ ;;
+ esac
+ eend $? "Root filesystem could not be mounted read/write"
+ if [ $? -eq 0 ]; then
+ rm -f /fastboot /forcefsck
+ fi
+ fi
+ ;;
esac
- if echo 2>/dev/null >/.test.$$; then
- rm -f /.test.$$ /fastboot /forcefsck
- return 0
- fi
-
- ebegin "Remounting root filesystem read/write"
- case "$RC_UNAME" in
- Linux) mount -n -o remount,rw /;;
- *) mount -u -o rw /;;
- esac
- if eend $? "Root filesystem could not be mounted read/write"; then
- rm -f /fastboot /forcefsck
- fi
+ ebegin "Remounting filesystems"
+ local mountpoint
+ for mountpoint in $(fstabinfo); do
+ case "${mountpoint}" in
+ /)
+ ;;
+ /*)
+ mountinfo -q "${mountpoint}" && fstabinfo --remount "${mountpoint}"
+ ;;
+ esac
+ done
+ eend 0
}