base/dracut-lib: add setdebug

do not clutter rdinitdebug output with getarg and getargs debug
master
Harald Hoyer 2009-10-01 14:32:52 +02:00
parent d84c1df906
commit 52aeb3f312
2 changed files with 22 additions and 10 deletions

View 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


View File

@ -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