[readonly/geninitrd: 486/1068] - really commit debuginitrd=sh functionality

draenog draenog at pld-linux.org
Sat Nov 2 19:53:15 CET 2013


commit e7751933850cd794efed5b372100d9e0f105b9a9
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Tue Oct 30 15:53:38 2007 +0000

    - really commit debuginitrd=sh functionality
    
    svn-id: @8900

 geninitrd | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 332f6b3..d33bd4c 100755
--- a/geninitrd
+++ b/geninitrd
@@ -1250,19 +1250,24 @@ add_linuxrc <<-'EOF'
 	#!/bin/sh
 	mount -t proc none /proc
 	export CMDLINE="$(cat /proc/cmdline)"
-	if [ "$(awk '/debuginitrd/ { print "yes" }' /proc/cmdline)" = "yes" ]; then
-		export DEBUGINITRD=yes
+	umount /proc
+
+	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; } } }')
+
+	# make debugshell() invoke subshell if $DEBUGINITRD=sh
+	if [ "$DEBUGINITRD" = "sh" ]; then
 		debugshell() {
-			: 'Entering debug shell. Type Ctrl-D to exit it.'
 			sh
 		}
-		set -x
 	else
 		debugshell() {
 			:
 		}
 	fi
-	umount /proc
+
+	if [ "$DEBUGINITRD" ]; then
+		set -x
+	fi
 EOF
 
 modules_add_linuxrc "$MODULES"
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list