[projects/geninitrd] Handle rootflags= option. Leave support for (invalid) rootfsflags= option.

arekm arekm at pld-linux.org
Fri Apr 11 10:00:40 CEST 2014


commit 144396dde6b302f400e1c2b9ec3fb30bd680e6a2
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Apr 11 10:00:37 2014 +0200

    Handle rootflags= option. Leave support for (invalid) rootfsflags= option.

 geninitrd                     | 17 ++++++++++++++---
 tests/initramfs_switchroot.sh |  4 ++--
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 6f12e2b..02dfc0e 100755
--- a/geninitrd
+++ b/geninitrd
@@ -964,9 +964,9 @@ initrd_gen_initramfs_switchroot() {
 			done < /proc/partitions
 		fi
 
-		[ -n "$ROOTFSFLAGS" ] && ROOTFSFLAGS="-o $ROOTFSFLAGS"
+		[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
 
-		mount -t $ROOTFS -r $device $ROOTFSFLAGS /newroot || echo "Mount of rootfs failed."
+		mount -t $ROOTFS -r $device $ROOTFLAGS /newroot || echo "Mount of rootfs failed."
 		init=$INIT
 		if [ -z "$init" -o ! -x "/newroot$init" ]; then
 			init=/sbin/init
@@ -1486,6 +1486,8 @@ add_linuxrc <<-'EOF'
 		if [ "${arg##root=}" != "${arg}" ]; then
 			ROOT=${arg##root=}
 		fi
+		if [ "${arg##rootflags=}" != "${arg}" ]; then
+			ROOTFLAGS=${arg##rootflags=}
 		if [ "${arg##rootfsflags=}" != "${arg}" ]; then
 			ROOTFSFLAGS=${arg##rootfsflags=}
 		fi
@@ -1494,9 +1496,18 @@ add_linuxrc <<-'EOF'
 		fi
 	done
 
+	# handling of invalid, rootfsflags, option
+	if [ -n "$ROOTFSFLAGS" ]; then
+		if [ -n "$ROOTFLAGS" ]; then
+			ROOTFLAGS="$ROOTFLAGS,$ROOTFSFLAGS"
+		else
+			ROOTFLAGS="$ROOTFSFLAGS"
+		fi
+	fi
+
 	if [ "$DEBUGINITRD" = "sh" ]; then
 		# export some vars to subshell for debug to work
-		export CMDLINE ROOT ROOTFS ROOTDEV ROOTFSFLAGS DEBUGINITRD INIT
+		export CMDLINE ROOT ROOTFS ROOTDEV ROOTFLAGS DEBUGINITRD INIT
 		export LVM_ROOTVG LVM_SUSPENDVG LVM_VGVOLUMES
 		export rootnr attrs majmin major minor device
 
diff --git a/tests/initramfs_switchroot.sh b/tests/initramfs_switchroot.sh
index e3d5c4c..ce020cb 100755
--- a/tests/initramfs_switchroot.sh
+++ b/tests/initramfs_switchroot.sh
@@ -90,9 +90,9 @@ printf("# BEGIN: root=[%s] maj=%s, min=%s\n", root, maj, min);
 			mknod $device b $maj $min
 		fi
 
-		[ -n "$ROOTFSFLAGS" ] && ROOTFSFLAGS="-o $ROOTFSFLAGS"
+		[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
 
-		mount -t $ROOTFS -r $device $ROOTFSFLAGS /newroot || echo "Mount of rootfs failed."
+		mount -t $ROOTFS -r $device $ROOTFLAGS /newroot || echo "Mount of rootfs failed."
 		init=$INIT
 		if [ -z "$init" -o ! -x "/newroot$init" ]; then
 			init=/sbin/init
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/geninitrd.git/commitdiff/144396dde6b302f400e1c2b9ec3fb30bd680e6a2



More information about the pld-cvs-commit mailing list