From 08c9da4c2c8873cbfda477f8744cd58a585a6108 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 19 May 2010 09:37:20 +0200
Subject: [PATCH] get rid of rdnetdebug

set PS4 and output to /dev/initlog.pipe
---
 dracut.8                                | 3 ---
 modules.d/40network/dhclient-script     | 8 ++------
 modules.d/95fcoe/fcoe-up                | 4 ++++
 modules.d/98syslog/parse-syslog-opts.sh | 6 +-----
 modules.d/98syslog/rsyslogd-start.sh    | 7 +------
 modules.d/98syslog/syslog-cleanup.sh    | 8 +-------
 modules.d/98syslog/syslog-genrules.sh   | 6 ------
 modules.d/99base/dracut-lib.sh          | 2 +-
 8 files changed, 10 insertions(+), 34 deletions(-)

diff --git a/dracut.8 b/dracut.8
index 404c2a1..0946b99 100644
--- a/dracut.8
+++ b/dracut.8
@@ -165,9 +165,6 @@ set udev to loglevel info
 .TP
 .B rdudevdebug
 set udev to loglevel debug
-.TP
-.B rdnetdebug
-debug network scripts in dracut. Output is written to /tmp/
 
 .SS I18N
  e.g.
diff --git a/modules.d/40network/dhclient-script b/modules.d/40network/dhclient-script
index 3efbc2d..1f5c4c0 100755
--- a/modules.d/40network/dhclient-script
+++ b/modules.d/40network/dhclient-script
@@ -44,14 +44,10 @@ setup_interface() {
 
 PATH=$PATH:/sbin:/usr/sbin
 
+export PS4="dhclient.$interface.$$ + "
+exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
 . /lib/dracut-lib.sh
 
-if getarg rdnetdebug ; then
-    exec >/tmp/dhclient.$interface.$$.out
-    exec 2>>/tmp/dhclient.$interface.$$.out
-    set -x
-fi
-
 # We already need a set netif here
 netif=$interface
 
diff --git a/modules.d/95fcoe/fcoe-up b/modules.d/95fcoe/fcoe-up
index 47a7e8d..9954e0a 100755
--- a/modules.d/95fcoe/fcoe-up
+++ b/modules.d/95fcoe/fcoe-up
@@ -11,6 +11,10 @@ PATH=$PATH:/sbin:/usr/sbin
 # Huh? Missing arguments ??
 [ -z "$1" -o -z "$2" ] && exit 1
 
+export PS4="fcoe-up.$1.$$ + "
+exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
+. /lib/dracut-lib.sh
+
 netif=$1
 dcb=$2
 
diff --git a/modules.d/98syslog/parse-syslog-opts.sh b/modules.d/98syslog/parse-syslog-opts.sh
index 0ec3015..438ab4b 100755
--- a/modules.d/98syslog/parse-syslog-opts.sh
+++ b/modules.d/98syslog/parse-syslog-opts.sh
@@ -6,11 +6,7 @@
 #sysloglevel=level  What level has to be logged
 #syslogtype=rsyslog|syslog|syslogng  
 #                   Don't auto detect syslog but set it
-if getarg rdnetdebug ; then
-    exec >/tmp/syslog-parse-opts.$1.$$.out
-    exec 2>>/tmp/syslog-parse-opts.$1.$$.out
-    set -x
-fi
+. /lib/dracut-lib.sh
 
 syslogserver=$(getarg syslog)
 syslogfilters=$(getargs filter)
diff --git a/modules.d/98syslog/rsyslogd-start.sh b/modules.d/98syslog/rsyslogd-start.sh
index abab484..4bfadc1 100755
--- a/modules.d/98syslog/rsyslogd-start.sh
+++ b/modules.d/98syslog/rsyslogd-start.sh
@@ -1,12 +1,7 @@
 #!/bin/sh
 # Triggered by udev and starts rsyslogd with bootparameters
-. /lib/dracut-lib.sh
 
-if getarg rdnetdebug ; then
-    exec >/tmp/rsyslogd-start.$1.$$.out
-    exec 2>>/tmp/rsyslogd-start.$1.$$.out
-    set -x
-fi
+. /lib/dracut-lib.sh
 
 rsyslog_config() {
 	local server=$1
diff --git a/modules.d/98syslog/syslog-cleanup.sh b/modules.d/98syslog/syslog-cleanup.sh
index 8fdf21b..4e1c531 100755
--- a/modules.d/98syslog/syslog-cleanup.sh
+++ b/modules.d/98syslog/syslog-cleanup.sh
@@ -1,13 +1,7 @@
 #!/bin/sh
 # Just cleans up a previously started syslogd
-. /lib/dracut-lib.sh
-
 
-if getarg rdnetdebug ; then
-    exec >/tmp/syslog-cleanup.$1.$$.out
-    exec 2>>/tmp/syslog-cleanup.$1.$$.out
-    set -x
-fi
+. /lib/dracut-lib.sh
 
 if [ -f /tmp/syslog.server ]; then
 	read syslogtype < /tmp/syslog.type
diff --git a/modules.d/98syslog/syslog-genrules.sh b/modules.d/98syslog/syslog-genrules.sh
index 8d99fb8..fb11f44 100755
--- a/modules.d/98syslog/syslog-genrules.sh
+++ b/modules.d/98syslog/syslog-genrules.sh
@@ -17,12 +17,6 @@ detect_syslog() {
     [ -n "$syslogtype" ]
 }	
 
-if getarg rdnetdebug ; then
-    exec >/tmp/syslog-genrules.$1.$$.out
-    exec 2>>/tmp/syslog-genrules.$1.$$.out
-    set -x
-fi
-
 read syslogtype < /tmp/syslog.type
 if [ -z "$syslogtype" ]; then
 	syslogtype=$(detect_syslog)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index e9c2ccc..9666232 100644
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -52,7 +52,7 @@ setdebug() {
     if [ -z "$RDDEBUG" ]; then
         if [ -e /proc/cmdline ]; then
             RDDEBUG=no
-            if getarg rdinitdebug; then
+            if getarg rdinitdebug || getarg rdnetdebug; then
                 RDDEBUG=yes 
             fi
         fi
-- 
1.8.3.1

