[readonly/geninitrd: 496/1068] - parse CMDINE using shell constructs

draenog draenog at pld-linux.org
Sat Nov 2 19:54:05 CET 2013


commit e934d044da1c179ad1b1fb1dd761fa329c125c9a
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Thu Nov 1 22:49:21 2007 +0000

    - parse CMDINE using shell constructs
    
    svn-id: @8952

 geninitrd | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/geninitrd b/geninitrd
index ad878a7..6aed54f 100755
--- a/geninitrd
+++ b/geninitrd
@@ -1332,7 +1332,14 @@ mount_proc
 add_linuxrc <<-'EOF'
 	export CMDLINE="$(cat /proc/cmdline)"
 
-	export DEBUGINITRD=$(echo "$CMDLINE" | awk '{ for (i=1; i<=NF; i++) { if ($i == "debuginitrd") { print "yes"; exit }; if ($i ~ /^debuginitrd=/) { gsub(/^debuginitrd=/, NIL, $i); print $i; exit; } } }')
+	for arg in $CMDLINE; do
+		if [ "${arg}" = "debuginitrd" ]; then
+			DEBUGINITRD=yes
+		fi
+		if [ "${arg##debuginitrd=}" != "${arg}" ]; then
+			DEBUGINITRD=${arg##debuginitrd=}
+		fi
+	done
 
 	# make debugshell() invoke subshell if $DEBUGINITRD=sh
 	if [ "$DEBUGINITRD" = "sh" ]; then
@@ -1692,6 +1699,7 @@ initrd_gen_lvm() {
 				major="${majmin%:*}"
 				minor="${majmin#*:}"
 			fi
+
 			if [ "$major" -a "$minor" ]; then
 				# Pass it to kernel
 				echo $((256 * $major + $minor)) > /proc/sys/kernel/real-root-dev
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090



More information about the pld-cvs-commit mailing list