summaryrefslogtreecommitdiff
path: root/packages/initscripts/initscripts-openmoko/checkroot.sh
diff options
context:
space:
mode:
authorChia-I Wu <olv@openmoko.com>2008-10-28 16:49:38 +0800
committerJohn Lee <john_lee@openmoko.org>2009-01-12 14:29:03 +0800
commit321b7dc88878ff24a48065048e01957d440a81c5 (patch)
treebcc1f0efb06afb662e250a45b83585870413eb30 /packages/initscripts/initscripts-openmoko/checkroot.sh
parent0cd7f559c01c45f5fc287e533b7456fc2ba79cb9 (diff)
fastboot: initscripts-openmoko: Replacement for initscripts.
Move the common files into 'files' dir and keep Openmoko specific files under initscripts-openmoko. 'finish' was renamed to 'finish.sh', so various recipes have to be modified as well.
Diffstat (limited to 'packages/initscripts/initscripts-openmoko/checkroot.sh')
-rw-r--r--packages/initscripts/initscripts-openmoko/checkroot.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/initscripts/initscripts-openmoko/checkroot.sh b/packages/initscripts/initscripts-openmoko/checkroot.sh
new file mode 100644
index 0000000000..029ae9b405
--- /dev/null
+++ b/packages/initscripts/initscripts-openmoko/checkroot.sh
@@ -0,0 +1,43 @@
+#
+# checkroot.sh Check to root filesystem.
+#
+# Version: @(#)checkroot.sh 2.84 25-Jan-2002 miquels@cistron.nl
+#
+
+. /etc/default/rcS
+
+#
+# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned
+# from this script *before anything else* with a timeout, like SCO does.
+#
+test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE
+
+#
+# If the root filesystem was not marked as read-only in /etc/fstab,
+# remount the rootfs rw but do not try to change mtab because it
+# is on a ro fs until the remount succeeded. Then clean up old mtabs
+# and finally write the new mtab.
+# This part is only needed if the rootfs was mounted ro.
+#
+ROOTFSDEV="/dev/root"
+if grep -q "^$ROOTFSDEV .* rw" /proc/mounts; then
+ echo "Root filesystem already read-write, not remounting"
+else
+ rootmode=rw
+
+ echo "Remounting root file system..."
+ mount -n -o remount,noatime,$rootmode /
+ if test "$rootmode" = rw
+ then
+ if test ! -L /etc/mtab
+ then
+ rm -f /etc/mtab~ /etc/nologin
+ : > /etc/mtab
+ fi
+ mount -f -o remount /
+ mount -f /proc
+ test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs"
+ fi
+fi
+
+: exit 0