# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
+debug_off() {
+ set +x
+}
+
+debug_on() {
+ [ "$RD_DEBUG" = "yes" ] && set -x
+}
+
# returns OK if $1 contains $2
strstr() {
[ "${1#*$2*}" != "$1" ]
}
getarg() {
- set +x
+ debug_off
while [ $# -gt 0 ]; do
case $1 in
-y) if _dogetarg $2 >/dev/null; then
echo 1
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
return 0
fi
shift 2;;
-n) if _dogetarg $2 >/dev/null; then
echo 0;
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
return 1
fi
shift 2;;
*) if _dogetarg $1; then
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
return 0;
fi
shift;;
esac
done
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
return 1
}
}
_dogetargs() {
- set +x
+ debug_off
local _o _found _key
unset _o
unset _found
}
getargs() {
- set +x
+ debug_off
local _val _i _args _gfound
unset _val
unset _gfound
else
echo -n 1
fi
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
return 0
fi
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
return 1;
}
#
# TODO: ':' inside fields.
splitsep() {
+ debug_off
local sep="$1"; local str="$2"; shift 2
local tmp
shift
done
[ -n "$str" -a -n "$1" ] && eval "$1=$str"
-
+ debug_on
return 0
}
fi
export RD_DEBUG
fi
- [ "$RD_DEBUG" = "yes" ] && set -x
+ debug_on
}
setdebug
}
incol2() {
+ debug_off
local dummy check;
local file="$1";
local str="$2";
[ -z "$str" ] && return 1;
while read dummy check restofline; do
- [ "$check" = "$str" ] && return 0
+ if [ "$check" = "$str" ]; then
+ debug_on
+ return 0
+ fi
done < $file
+ debug_on
return 1
}
}
killproc() {
+ debug_off
local _exe="$(command -v $1)"
local _sig=$2
local _i
kill $_sig ${_i##*/}
fi
done
+ debug_on
}
need_shutdown() {
{
[ "$RD_DEBUG" = "yes" ] || return
[ -e /run/initramfs/loginit.pipe ] || return
- set +x
+ debug_off
echo "DRACUT_LOG_END"
exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
# wait for loginit
done
export RD_TIMESTAMP
-set +x # Turn off debugging for this section
# Clean up the environment
for i in $(export -p); do
i=${i#declare -x}
initargs=""
read CLINE </proc/cmdline
if getarg init= >/dev/null ; then
- set +x # Turn off debugging for this section
ignoreargs="console BOOT_IMAGE"
# only pass arguments after init= to the init
CLINE=${CLINE#*init=}
done
unset CLINE
else
- set +x # Turn off debugging for this section
+ debug_off # Turn off debugging for this section
set -- $CLINE
for x in "$@"; do
case "$x" in
esac
done
fi
-[ "$RD_DEBUG" = "yes" ] && set -x
+debug_on
if ! [ -d "$NEWROOT"/run ]; then
NEWRUN=/dev/.initramfs