aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-09 21:10:53 +0000
committerRoy Marples <roy@marples.name>2007-10-09 21:10:53 +0000
commit31c6cacb0a92d4fc8d024ca51eb83058398bb6b5 (patch)
tree1790ddbd570209aae199499c105afc2361a5b5ec
parentd4685722060c23b625164beccacab6b476fcd5cd (diff)
Always remount root rw if it's not
-rwxr-xr-xinit.d/checkroot26
1 files changed, 17 insertions, 9 deletions
diff --git a/init.d/checkroot b/init.d/checkroot
index 0dfd0047..a392ea36 100755
--- a/init.d/checkroot
+++ b/init.d/checkroot
@@ -30,6 +30,11 @@ do_mtab() {
rm -f /etc/mtab~ /etc/mtab~~
}
+root_rw() {
+ echo 2>/dev/null >/.test.$$ || return 1
+ rm -f /.test.$$
+}
+
do_fsck() {
local retval=0 opts=
case "${RC_UNAME}" in
@@ -42,9 +47,8 @@ do_fsck() {
return 0
fi
- if echo 2>/dev/null >/.test.$$ ; then
+ if root_rw; then
einfo "root filesystem is mounted read-write - skipping"
- rm -f /.test.$$
return 0
fi
@@ -106,18 +110,22 @@ do_fsck() {
fi
fi
- ebegin "Remounting root filesystem read/write"
- if [ "${RC_UNAME}" = "Linux" ] ; then
- mount -n -o remount,rw /
- else
- mount -u -o rw /
- fi
- eend $? "Root filesystem could not be mounted read/write :("
}
start() {
do_fsck || return 1
+ if ! root_rw; then
+ ebegin "Remounting root filesystem read/write"
+ if [ "${RC_UNAME}" = "Linux" ] ; then
+ mount -n -o remount,rw /
+ else
+ mount -u -o rw /
+ fi
+ eend $? "Root filesystem could not be mounted read/write :("
+ return $?
+ fi
+
# Only Linux has mtab
[ "${RC_UNAME}" = "Linux" ] && do_mtab