[readonly/geninitrd: 537/1068] - reuse $CMDLINE

draenog draenog at pld-linux.org
Sat Nov 2 19:57:33 CET 2013


commit 55884ae2b743fd77cf1179027c750a8e8730419e
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Mon Nov 26 18:09:56 2007 +0000

    - reuse $CMDLINE
    
    svn-id: @9095

 geninitrd | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 708263a..efa848b 100755
--- a/geninitrd
+++ b/geninitrd
@@ -1022,16 +1022,25 @@ initrd_gen_suspend() {
 	else
 		inst /usr/sbin/resume /bin/resume
 	fi
-	echo "resume" | add_linuxrc
+
+	add_linuxrc <<-'EOF'
+	resume
+	EOF
 }
 
 initrd_gen_tuxonice() {
 	mount_sys
 	add_linuxrc <<-'EOF'
-		if [ "$(echo "$CMDLINE" | awk ' /resume2=/  { print "yes"; } ' /proc/cmdline)" = "yes" ]; then
+		resume2=no
+		for arg in $CMDLINE; do
+			if [ "${arg##resume2=}" != "${arg}" ]; then
+				resume2=yes
+			fi
+		done
+		if [ "$resume2" = "yes" ]; then
 			[ -e /proc/suspend2/do_resume ] && echo > /proc/suspend2/do_resume
 			[ -e /sys/power/suspend2/do_resume ] && echo > /sys/power/suspend2/do_resume
-			[ -e /sys/power/tuxonice/do_resume ] && echo >  /sys/power/tuxonice/do_resume
+			[ -e /sys/power/tuxonice/do_resume ] && echo > /sys/power/tuxonice/do_resume
 		fi
 	EOF
 }
@@ -1455,7 +1464,7 @@ initrd_gen_lvm() {
 initrd_gen_procdata() {
 	debug "Adding rootfs finding based on kernel cmdline root= option support."
 	add_linuxrc <<-'EOF'
-		root="$(busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ' /proc/cmdline)"
+		root="$(echo "$CMDLINE" | busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ')"
 		if [ -n "$root" ]; then
 			rootnr="$(busybox awk -v root="$root" ' { if ($4 == root) { print 256*$1+$2; } } ' /proc/partitions)"
 			if [ -n "$rootnr" ]; then
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list