Support rootflags and rootfstype kernel parameters.
authorVictor Lowther <victor.lowther@gmail.com>
Sat, 21 Feb 2009 16:24:35 +0000 (08:24 -0800)
committerDave Jones <davej@redhat.com>
Mon, 23 Feb 2009 18:22:01 +0000 (13:22 -0500)
This also folds in support for ro and rw flags.

init

diff --git a/init b/init
index 7b0c61b..581c2b9 100755 (executable)
--- a/init
+++ b/init
@@ -79,10 +79,16 @@ udevadm settle --timeout=30
 source_all pre-mount
 
 echo "Trying to mount rootfs $root"
-rwopt="$(getarg rw)" || rwopt="ro"
+if rflags="$(getarg rootflags)"; then
+    rflags="${rflags#rootflags=}"
+    getarg rw >/dev/null && rflags="${rflags},rw" || rflags="${rflags},ro"
+else
+     getarg rw >/dev/null && rflags=rw || rflags=ro
+fi
 [ -e "$root" ] || emergency_shell
-ln -s "$root" /dev/root    
-mount -o $rwopt /dev/root $NEWROOT || emergency_shell
+ln -s "$root" /dev/root 
+fstype="$(getarg rootfstype)" && fstype="-t ${fstype#rootfstype=}" 
+mount $fstype -o $rflags /dev/root $NEWROOT || emergency_shell
 
 INIT=$(getarg init)
 [ "$INIT" ] || {