]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
base/dracut-lib: add setdebug
authorHarald Hoyer <harald@redhat.com>
Thu, 1 Oct 2009 12:32:52 +0000 (14:32 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 1 Oct 2009 12:46:16 +0000 (14:46 +0200)
do not clutter rdinitdebug output with getarg and getargs debug

modules.d/99base/dracut-lib.sh
modules.d/99base/init

index a140125f9561fda44a7d1657f248c31df1bf7a77..01d8bd9cf5140662dd208db185312e2f1ed0e2b2 100644 (file)
@@ -1,4 +1,5 @@
 getarg() {
+    set +x
     local o line
     if [ -z "$CMDLINE" ]; then
        [ -e /etc/cmdline ] && read CMDLINE_ETC </etc/cmdline;
@@ -7,12 +8,28 @@ getarg() {
     fi
     for o in $CMDLINE; do
        [ "$o" = "$1" ] && return 0
-       [ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
+       [ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; setdebug; return 0; }
     done
+    setdebug
     return 1
 }
 
+setdebug() {
+    if [ -z "$RDDEBUG" ]; then
+        if [ -e /proc/cmdline ]; then
+            RDDEBUG=no
+           if getarg rdinitdebug; then
+                RDDEBUG=yes 
+            fi
+        fi
+    fi
+    [ "$RDDEBUG" = "yes" ] && set -x 
+}
+
+setdebug
+
 getargs() {
+    set +x
     local o line found
     if [ -z "$CMDLINE" ]; then
        [ -e /etc/cmdline ] && read CMDLINE_ETC </etc/cmdline;
@@ -26,7 +43,8 @@ getargs() {
            found=1;
        fi
     done
-    [ -n "$found" ] && return 0
+    [ -n "$found" ] && { setdebug; return 0;}
+    setdebug
     return 1
 }
 
@@ -134,9 +152,4 @@ udevproperty() {
     fi
 }
 
-if [ -e /proc/cmdline ]; then
-       if getarg rdinitdebug; then
-           set -x
-       fi
-fi
 
index be80043c4dfd31bac88f9535b7b2cf59d761ad0e..a3b26c22b87d948d584fb4dbae580fc8fdeb7a18 100755 (executable)
@@ -28,6 +28,7 @@ NEWROOT="/sysroot"
 
 trap "emergency_shell Signal caught!" 0
 
+RDDEBUG=""
 . /lib/dracut-lib.sh
 
 mknod /dev/null c 1 3
@@ -49,9 +50,7 @@ if [ ! -c /dev/ptmx ]; then
     fi
 fi
 
-if getarg rdinitdebug; then
-    set -x
-fi
+setdebug
 
 mkdir /dev/shm
 mkdir /dev/pts