Blame 0085-cope-with-rd.shell-0-in-the-testsuite.patch

Harald Hoyer 414eba
From 781f1971c326da07d22516a4b555138b1978177b Mon Sep 17 00:00:00 2001
Harald Hoyer 414eba
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 414eba
Date: Wed, 8 Jun 2016 09:33:48 +0200
Harald Hoyer 414eba
Subject: [PATCH] cope with "rd.shell=0" in the testsuite
Harald Hoyer 414eba
Harald Hoyer 414eba
If emergency and shutdown-emergency hooks are called, the systemd should
Harald Hoyer 414eba
poweroff the testsuite, therefore "rd.shell=0" is given on the test
Harald Hoyer 414eba
suite kernel command lines.
Harald Hoyer 414eba
Harald Hoyer 414eba
"rd.shell=0" has to be parsed correctly by the test suite real root init
Harald Hoyer 414eba
also.
Harald Hoyer 414eba
---
Harald Hoyer 414eba
 test/TEST-01-BASIC/hard-off.sh         |   4 +-
Harald Hoyer 414eba
 test/TEST-01-BASIC/test-init.sh        |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-01-BASIC/test.sh             |   3 +-
Harald Hoyer 414eba
 test/TEST-02-SYSTEMD/hard-off.sh       |   4 +-
Harald Hoyer 414eba
 test/TEST-02-SYSTEMD/test-init.sh      | 100 ++++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-02-SYSTEMD/test.sh           |   3 +-
Harald Hoyer 414eba
 test/TEST-03-USR-MOUNT/hard-off.sh     |   4 +-
Harald Hoyer 414eba
 test/TEST-03-USR-MOUNT/test-init.sh    |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-03-USR-MOUNT/test.sh         |   3 +-
Harald Hoyer 414eba
 test/TEST-04-FULL-SYSTEMD/hard-off.sh  |   4 +-
Harald Hoyer 414eba
 test/TEST-04-FULL-SYSTEMD/test-init.sh |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-04-FULL-SYSTEMD/test.sh      |   3 +-
Harald Hoyer 414eba
 test/TEST-10-RAID/hard-off.sh          |   4 +-
Harald Hoyer 414eba
 test/TEST-10-RAID/test-init.sh         |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-10-RAID/test.sh              |   3 +-
Harald Hoyer 414eba
 test/TEST-11-LVM/hard-off.sh           |   4 +-
Harald Hoyer 414eba
 test/TEST-11-LVM/test-init.sh          |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-11-LVM/test.sh               |   3 +-
Harald Hoyer 414eba
 test/TEST-12-RAID-DEG/hard-off.sh      |   4 +-
Harald Hoyer 414eba
 test/TEST-12-RAID-DEG/test-init.sh     |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-12-RAID-DEG/test.sh          |   3 +-
Harald Hoyer 414eba
 test/TEST-13-ENC-RAID-LVM/hard-off.sh  |   4 +-
Harald Hoyer 414eba
 test/TEST-13-ENC-RAID-LVM/test.sh      |   3 +-
Harald Hoyer 414eba
 test/TEST-14-IMSM/hard-off.sh          |   4 +-
Harald Hoyer 414eba
 test/TEST-14-IMSM/test-init.sh         |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-14-IMSM/test.sh              |   3 +-
Harald Hoyer 414eba
 test/TEST-15-BTRFSRAID/hard-off.sh     |   4 +-
Harald Hoyer 414eba
 test/TEST-15-BTRFSRAID/test.sh         |   3 +-
Harald Hoyer 414eba
 test/TEST-16-DMSQUASH/hard-off.sh      |   4 +-
Harald Hoyer 414eba
 test/TEST-16-DMSQUASH/test-init.sh     |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-16-DMSQUASH/test.sh          |   3 +-
Harald Hoyer 414eba
 test/TEST-17-LVM-THIN/hard-off.sh      |   2 +-
Harald Hoyer 414eba
 test/TEST-17-LVM-THIN/test-init.sh     |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-17-LVM-THIN/test.sh          |   3 +-
Harald Hoyer 414eba
 test/TEST-20-NFS/client-init.sh        |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-20-NFS/hard-off.sh           |   4 +-
Harald Hoyer 414eba
 test/TEST-20-NFS/test.sh               |   3 +-
Harald Hoyer 414eba
 test/TEST-30-ISCSI/client-init.sh      |  97 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-30-ISCSI/hard-off.sh         |   4 +-
Harald Hoyer 414eba
 test/TEST-30-ISCSI/test.sh             |   3 +-
Harald Hoyer 414eba
 test/TEST-40-NBD/hard-off.sh           |   4 +-
Harald Hoyer 414eba
 test/TEST-40-NBD/test.sh               |   3 +-
Harald Hoyer 414eba
 test/TEST-50-MULTINIC/client-init.sh   |  98 +++++++++++++++++++++++++++++++-
Harald Hoyer 414eba
 test/TEST-50-MULTINIC/hard-off.sh      |   4 +-
Harald Hoyer 414eba
 test/TEST-50-MULTINIC/test.sh          |   3 +-
Harald Hoyer 414eba
 45 files changed, 1315 insertions(+), 60 deletions(-)
Harald Hoyer 414eba
Harald Hoyer 414eba
diff --git a/test/TEST-01-BASIC/hard-off.sh b/test/TEST-01-BASIC/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-01-BASIC/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-01-BASIC/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-01-BASIC/test-init.sh b/test/TEST-01-BASIC/test-init.sh
Harald Hoyer 414eba
index ef196ec..a8b6e39 100755
Harald Hoyer 414eba
--- a/test/TEST-01-BASIC/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-01-BASIC/test-init.sh
Harald Hoyer 414eba
@@ -1,5 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
 >/dev/watchdog
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -12,7 +107,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 414eba
+if getargbool 0 rd.shell; then
Harald Hoyer 414eba
 	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 414eba
 	setsid $CTTY sh -i
Harald Hoyer 414eba
 fi
Harald Hoyer 414eba
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
Harald Hoyer 414eba
index 959ac05..ab84074 100755
Harald Hoyer 414eba
--- a/test/TEST-01-BASIC/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-01-BASIC/test.sh
Harald Hoyer 414eba
@@ -14,7 +14,7 @@ test_run() {
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
 	-watchdog i6300esb -watchdog-action poweroff \
Harald Hoyer 414eba
-	-append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing || return 1
Harald Hoyer 414eba
     grep -F -m 1 -q dracut-root-block-success $TESTDIR/result || return 1
Harald Hoyer 414eba
 }
Harald Hoyer 414eba
@@ -90,6 +90,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-02-SYSTEMD/hard-off.sh b/test/TEST-02-SYSTEMD/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-02-SYSTEMD/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-02-SYSTEMD/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-02-SYSTEMD/test-init.sh b/test/TEST-02-SYSTEMD/test-init.sh
Harald Hoyer 414eba
index b7e0192..0999bc0 100755
Harald Hoyer 414eba
--- a/test/TEST-02-SYSTEMD/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-02-SYSTEMD/test-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,102 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -11,7 +109,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 414eba
+if getargbool 0 rd.shell; then
Harald Hoyer 414eba
 	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 414eba
 	setsid $CTTY sh -i
Harald Hoyer 414eba
 fi
Harald Hoyer 414eba
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
Harald Hoyer 414eba
index 6dc6f42..350cff8 100755
Harald Hoyer 414eba
--- a/test/TEST-02-SYSTEMD/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-02-SYSTEMD/test.sh
Harald Hoyer 414eba
@@ -10,7 +10,7 @@ test_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug init=/sbin/init $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug init=/sbin/init rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
Harald Hoyer 414eba
 }
Harald Hoyer 414eba
@@ -87,6 +87,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-03-USR-MOUNT/hard-off.sh b/test/TEST-03-USR-MOUNT/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-03-USR-MOUNT/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-03-USR-MOUNT/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-03-USR-MOUNT/test-init.sh b/test/TEST-03-USR-MOUNT/test-init.sh
Harald Hoyer 414eba
index 48fbfea..68eaff0 100755
Harald Hoyer 414eba
--- a/test/TEST-03-USR-MOUNT/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-03-USR-MOUNT/test-init.sh
Harald Hoyer 414eba
@@ -1,5 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
 >/dev/watchdog
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -22,7 +117,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 414eba
+if getargbool 0 rd.shell; then
Harald Hoyer 414eba
 	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 414eba
 	setsid $CTTY sh -i
Harald Hoyer 414eba
 fi
Harald Hoyer 414eba
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
Harald Hoyer 414eba
index 0aca8cf..ed76d35 100755
Harald Hoyer 414eba
--- a/test/TEST-03-USR-MOUNT/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-03-USR-MOUNT/test.sh
Harald Hoyer 414eba
@@ -21,7 +21,7 @@ client_run() {
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
 	-watchdog i6300esb -watchdog-action poweroff \
Harald Hoyer 414eba
-	-append "root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
 
Harald Hoyer 414eba
     if (($? != 0)); then
Harald Hoyer 414eba
@@ -125,6 +125,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-04-FULL-SYSTEMD/hard-off.sh b/test/TEST-04-FULL-SYSTEMD/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-04-FULL-SYSTEMD/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-04-FULL-SYSTEMD/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-04-FULL-SYSTEMD/test-init.sh b/test/TEST-04-FULL-SYSTEMD/test-init.sh
Harald Hoyer 414eba
index ad516f1..e388afc 100755
Harald Hoyer 414eba
--- a/test/TEST-04-FULL-SYSTEMD/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-04-FULL-SYSTEMD/test-init.sh
Harald Hoyer 414eba
@@ -1,5 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
 >/dev/watchdog
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -35,7 +130,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 414eba
+if getargbool 0 rd.shell; then
Harald Hoyer 414eba
 #	while sleep 1; do sleep 1;done
Harald Hoyer 414eba
 	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 414eba
 	setsid $CTTY sh -i
Harald Hoyer 414eba
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
Harald Hoyer 414eba
index 884f441..88711ef 100755
Harald Hoyer 414eba
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
Harald Hoyer 414eba
@@ -22,7 +22,7 @@ client_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=2,media=disk,file=$TESTDIR/result \
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
 
Harald Hoyer 414eba
     if (($? != 0)); then
Harald Hoyer 414eba
@@ -262,6 +262,7 @@ EOF
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
 
Harald Hoyer 414eba
diff --git a/test/TEST-10-RAID/hard-off.sh b/test/TEST-10-RAID/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-10-RAID/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-10-RAID/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-10-RAID/test-init.sh b/test/TEST-10-RAID/test-init.sh
Harald Hoyer 414eba
index c7c114e..7eb932a 100755
Harald Hoyer 414eba
--- a/test/TEST-10-RAID/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-10-RAID/test-init.sh
Harald Hoyer 414eba
@@ -1,5 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
 command -v plymouth >/dev/null && plymouth --quit
Harald Hoyer 414eba
@@ -11,7 +106,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 echo "Powering down."
Harald Hoyer 414eba
 mount -n -o remount,ro /
Harald Hoyer 414eba
 #echo " rd.break=shutdown " >> /run/initramfs/etc/cmdline
Harald Hoyer 414eba
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
Harald Hoyer 414eba
index 6ec77a6..2d09314 100755
Harald Hoyer 414eba
--- a/test/TEST-10-RAID/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-10-RAID/test.sh
Harald Hoyer 414eba
@@ -12,7 +12,7 @@ test_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
Harald Hoyer 414eba
 }
Harald Hoyer 414eba
@@ -87,6 +87,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst ./cryptroot-ask.sh /sbin/cryptroot-ask
Harald Hoyer 414eba
         mkdir -p $initdir/etc
Harald Hoyer 414eba
         echo "testluks UUID=$ID_FS_UUID /etc/key" > $initdir/etc/crypttab
Harald Hoyer 414eba
diff --git a/test/TEST-11-LVM/hard-off.sh b/test/TEST-11-LVM/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-11-LVM/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-11-LVM/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-11-LVM/test-init.sh b/test/TEST-11-LVM/test-init.sh
Harald Hoyer 414eba
index 61a9543..18fd2b3 100755
Harald Hoyer 414eba
--- a/test/TEST-11-LVM/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-11-LVM/test-init.sh
Harald Hoyer 414eba
@@ -1,5 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
 plymouth --quit
Harald Hoyer 414eba
@@ -11,7 +106,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 echo "Powering down."
Harald Hoyer 414eba
 mount -n -o remount,ro /
Harald Hoyer 414eba
 poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
Harald Hoyer 414eba
index 412a065..97c2f97 100755
Harald Hoyer 414eba
--- a/test/TEST-11-LVM/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-11-LVM/test.sh
Harald Hoyer 414eba
@@ -11,7 +11,7 @@ test_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug  $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1
Harald Hoyer 414eba
 }
Harald Hoyer 414eba
@@ -80,6 +80,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-12-RAID-DEG/hard-off.sh b/test/TEST-12-RAID-DEG/hard-off.sh
Harald Hoyer 414eba
index 07a8f1f..cf44fb0 100755
Harald Hoyer 414eba
--- a/test/TEST-12-RAID-DEG/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-12-RAID-DEG/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-! getarg rd.break && getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+! getargbool 0 rd.break && getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-12-RAID-DEG/test-init.sh b/test/TEST-12-RAID-DEG/test-init.sh
Harald Hoyer 414eba
index c7c114e..7eb932a 100755
Harald Hoyer 414eba
--- a/test/TEST-12-RAID-DEG/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-12-RAID-DEG/test-init.sh
Harald Hoyer 414eba
@@ -1,5 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
 command -v plymouth >/dev/null && plymouth --quit
Harald Hoyer 414eba
@@ -11,7 +106,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 echo "Powering down."
Harald Hoyer 414eba
 mount -n -o remount,ro /
Harald Hoyer 414eba
 #echo " rd.break=shutdown " >> /run/initramfs/etc/cmdline
Harald Hoyer 414eba
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
Harald Hoyer 414eba
index 444dca6..09d78dd 100755
Harald Hoyer 414eba
--- a/test/TEST-12-RAID-DEG/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-12-RAID-DEG/test.sh
Harald Hoyer 414eba
@@ -19,7 +19,7 @@ client_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img.new \
Harald Hoyer 414eba
 	-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img.new \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "$* root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL " \
Harald Hoyer 414eba
+	-append "$* root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL " \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
Harald Hoyer 414eba
 	echo "CLIENT TEST END: $@ [FAIL]"
Harald Hoyer 414eba
@@ -130,6 +130,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
 	inst ./cryptroot-ask.sh /sbin/cryptroot-ask
Harald Hoyer 414eba
         mkdir -p $initdir/etc
Harald Hoyer 414eba
diff --git a/test/TEST-13-ENC-RAID-LVM/hard-off.sh b/test/TEST-13-ENC-RAID-LVM/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-13-ENC-RAID-LVM/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-13-ENC-RAID-LVM/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
Harald Hoyer 414eba
index 2a814f8..3e8c3e2 100755
Harald Hoyer 414eba
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
Harald Hoyer 414eba
@@ -19,7 +19,7 @@ test_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img || return 1
Harald Hoyer 414eba
     echo "CLIENT TEST END: [OK]"
Harald Hoyer 414eba
@@ -124,6 +124,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
 	inst ./cryptroot-ask.sh /sbin/cryptroot-ask
Harald Hoyer 414eba
         mkdir -p $initdir/etc
Harald Hoyer 414eba
diff --git a/test/TEST-14-IMSM/hard-off.sh b/test/TEST-14-IMSM/hard-off.sh
Harald Hoyer 414eba
index f340d2d..780a0b2 100755
Harald Hoyer 414eba
--- a/test/TEST-14-IMSM/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-14-IMSM/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f 
Harald Hoyer 414eba
-getarg failme && poweroff -f 
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f 
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f 
Harald Hoyer 414eba
diff --git a/test/TEST-14-IMSM/test-init.sh b/test/TEST-14-IMSM/test-init.sh
Harald Hoyer 414eba
index ba63245..127185a 100755
Harald Hoyer 414eba
--- a/test/TEST-14-IMSM/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-14-IMSM/test-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,99 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -11,7 +106,7 @@ cat /proc/mdstat
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 echo "Powering down."
Harald Hoyer 414eba
 mount -n -o remount,ro /
Harald Hoyer 414eba
 poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
Harald Hoyer 414eba
index 315bc5a..9083fd5 100755
Harald Hoyer 414eba
--- a/test/TEST-14-IMSM/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-14-IMSM/test.sh
Harald Hoyer 414eba
@@ -15,7 +15,7 @@ client_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
Harald Hoyer 414eba
 	-m 256M -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "$* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "$* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
Harald Hoyer 414eba
 	echo "CLIENT TEST END: $@ [FAIL]"
Harald Hoyer 414eba
@@ -114,6 +114,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-15-BTRFSRAID/hard-off.sh b/test/TEST-15-BTRFSRAID/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-15-BTRFSRAID/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-15-BTRFSRAID/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
Harald Hoyer 414eba
index 8e2ea49..281f856 100755
Harald Hoyer 414eba
--- a/test/TEST-15-BTRFSRAID/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-15-BTRFSRAID/test.sh
Harald Hoyer 414eba
@@ -11,7 +11,7 @@ test_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
Harald Hoyer 414eba
 	-m 256M  -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     dd if=$DISKIMAGE bs=512 count=4 skip=2048 | grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
Harald Hoyer 414eba
 }
Harald Hoyer 414eba
@@ -88,6 +88,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-16-DMSQUASH/hard-off.sh b/test/TEST-16-DMSQUASH/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-16-DMSQUASH/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-16-DMSQUASH/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-16-DMSQUASH/test-init.sh b/test/TEST-16-DMSQUASH/test-init.sh
Harald Hoyer 414eba
index 206298d..5fe523c 100755
Harald Hoyer 414eba
--- a/test/TEST-16-DMSQUASH/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-16-DMSQUASH/test-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,99 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -11,7 +106,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 echo "Powering down."
Harald Hoyer 414eba
 mount -n -o remount,ro /
Harald Hoyer 414eba
 poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
Harald Hoyer 414eba
index b255492..4d72470 100755
Harald Hoyer 414eba
--- a/test/TEST-16-DMSQUASH/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-16-DMSQUASH/test.sh
Harald Hoyer 414eba
@@ -22,7 +22,7 @@ test_run() {
Harald Hoyer 414eba
         -m 256M -smp 2 \
Harald Hoyer 414eba
         -nographic \
Harald Hoyer 414eba
         -net none \
Harald Hoyer 414eba
-        -append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
Harald Hoyer 414eba
+        -append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
         -initrd "$TESTDIR"/initramfs.testing
Harald Hoyer 414eba
 
Harald Hoyer 414eba
     # mediacheck test with qemu GUI
Harald Hoyer 414eba
@@ -44,6 +44,7 @@ test_setup() {
Harald Hoyer 414eba
 	. "$basedir"/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
 
Harald Hoyer 414eba
diff --git a/test/TEST-17-LVM-THIN/hard-off.sh b/test/TEST-17-LVM-THIN/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..f4d19dc 100755
Harald Hoyer 414eba
--- a/test/TEST-17-LVM-THIN/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-17-LVM-THIN/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
 getarg failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-17-LVM-THIN/test-init.sh b/test/TEST-17-LVM-THIN/test-init.sh
Harald Hoyer 414eba
index 61a9543..77fb346 100755
Harald Hoyer 414eba
--- a/test/TEST-17-LVM-THIN/test-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-17-LVM-THIN/test-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,99 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
@@ -11,7 +106,7 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 414eba
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
 echo "made it to the rootfs!"
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 echo "Powering down."
Harald Hoyer 414eba
 mount -n -o remount,ro /
Harald Hoyer 414eba
 poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh
Harald Hoyer 414eba
index e337591..1485f72 100755
Harald Hoyer 414eba
--- a/test/TEST-17-LVM-THIN/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-17-LVM-THIN/test.sh
Harald Hoyer 414eba
@@ -11,7 +11,7 @@ test_run() {
Harald Hoyer 414eba
 	-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
Harald Hoyer 414eba
 	-m 256M -smp 2 -nographic \
Harald Hoyer 414eba
 	-net none \
Harald Hoyer 414eba
-	-append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug  $DEBUGFAIL" \
Harald Hoyer 414eba
+	-append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
Harald Hoyer 414eba
 	-initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1
Harald Hoyer 414eba
 }
Harald Hoyer 414eba
@@ -80,6 +80,7 @@ test_setup() {
Harald Hoyer 414eba
 	. $basedir/dracut-init.sh
Harald Hoyer 414eba
 	inst_multiple poweroff shutdown
Harald Hoyer 414eba
 	inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh
Harald Hoyer 414eba
index a443289..eea162c 100755
Harald Hoyer 414eba
--- a/test/TEST-20-NFS/client-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-20-NFS/client-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,99 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 exec >/dev/console 2>&1
Harald Hoyer 414eba
 export TERM=linux
Harald Hoyer 414eba
@@ -7,7 +102,7 @@ CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
 
Harald Hoyer 414eba
 stty sane
Harald Hoyer 414eba
-if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 414eba
+if getargbool 0 rd.shell; then
Harald Hoyer 414eba
     [ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
Harald Hoyer 414eba
 	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 414eba
 	setsid $CTTY sh -i
Harald Hoyer 414eba
diff --git a/test/TEST-20-NFS/hard-off.sh b/test/TEST-20-NFS/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-20-NFS/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-20-NFS/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
Harald Hoyer 414eba
index 1dfdfc4..d7df71e 100755
Harald Hoyer 414eba
--- a/test/TEST-20-NFS/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-20-NFS/test.sh
Harald Hoyer 414eba
@@ -54,7 +54,7 @@ client_test() {
Harald Hoyer 414eba
         -net nic,macaddr=$mac,model=e1000 \
Harald Hoyer 414eba
         -net socket,connect=127.0.0.1:12320 \
Harald Hoyer 414eba
         -watchdog i6300esb -watchdog-action poweroff \
Harald Hoyer 414eba
-        -append "$cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet  ro console=ttyS0,115200n81 selinux=0" \
Harald Hoyer 414eba
+        -append "rd.shell=0 $cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet  ro console=ttyS0,115200n81 selinux=0" \
Harald Hoyer 414eba
         -initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
 
Harald Hoyer 414eba
     if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nfs-OK $TESTDIR/client.img; then
Harald Hoyer 414eba
@@ -335,6 +335,7 @@ test_setup() {
Harald Hoyer 414eba
         mkdir $TESTDIR/overlay
Harald Hoyer 414eba
         inst_multiple poweroff shutdown
Harald Hoyer 414eba
         inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
 
Harald Hoyer 414eba
diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh
Harald Hoyer 414eba
index 2e422cd..7279987 100755
Harald Hoyer 414eba
--- a/test/TEST-30-ISCSI/client-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-30-ISCSI/client-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,99 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
 exec >/dev/console 2>&1
Harald Hoyer 414eba
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer 414eba
@@ -13,7 +108,7 @@ while read dev fs fstype opts rest || [ -n "$dev" ]; do
Harald Hoyer 414eba
     break
Harald Hoyer 414eba
 done < /proc/mounts
Harald Hoyer 414eba
 #sh -i
Harald Hoyer 414eba
-if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 414eba
+if getargbool 0 rd.shell; then
Harald Hoyer 414eba
 	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 414eba
 	setsid $CTTY sh -i
Harald Hoyer 414eba
 fi
Harald Hoyer 414eba
diff --git a/test/TEST-30-ISCSI/hard-off.sh b/test/TEST-30-ISCSI/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-30-ISCSI/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-30-ISCSI/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
Harald Hoyer 414eba
index 1c06b06..83fd623 100755
Harald Hoyer 414eba
--- a/test/TEST-30-ISCSI/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-30-ISCSI/test.sh
Harald Hoyer 414eba
@@ -49,7 +49,7 @@ run_client() {
Harald Hoyer 414eba
         -net nic,macaddr=52:54:00:12:34:00,model=e1000 \
Harald Hoyer 414eba
         -net nic,macaddr=52:54:00:12:34:01,model=e1000 \
Harald Hoyer 414eba
         -net socket,connect=127.0.0.1:12330 \
Harald Hoyer 414eba
-        -append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
Harald Hoyer 414eba
+        -append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
Harald Hoyer 414eba
         -initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
     if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
Harald Hoyer 414eba
 	echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
Harald Hoyer 414eba
@@ -214,6 +214,7 @@ test_setup() {
Harald Hoyer 414eba
         . $basedir/dracut-init.sh
Harald Hoyer 414eba
         inst_multiple poweroff shutdown
Harald Hoyer 414eba
         inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer 414eba
diff --git a/test/TEST-40-NBD/hard-off.sh b/test/TEST-40-NBD/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-40-NBD/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-40-NBD/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
Harald Hoyer 414eba
index 2061392..40e09b7 100755
Harald Hoyer 414eba
--- a/test/TEST-40-NBD/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-40-NBD/test.sh
Harald Hoyer 414eba
@@ -58,7 +58,7 @@ client_test() {
Harald Hoyer 414eba
         -nographic \
Harald Hoyer 414eba
         -net nic,macaddr=$mac,model=e1000 \
Harald Hoyer 414eba
         -net socket,connect=127.0.0.1:12340 \
Harald Hoyer 414eba
-        -append "$cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81  selinux=0  " \
Harald Hoyer 414eba
+        -append "rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81  selinux=0  " \
Harald Hoyer 414eba
         -initrd $TESTDIR/initramfs.testing
Harald Hoyer 414eba
 
Harald Hoyer 414eba
     if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nbd-OK $TESTDIR/flag.img; then
Harald Hoyer 414eba
@@ -227,6 +227,7 @@ make_encrypted_root() {
Harald Hoyer 414eba
         )
Harald Hoyer 414eba
         inst_multiple mke2fs poweroff cp umount tune2fs
Harald Hoyer 414eba
         inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
         inst_hook initqueue 01 ./create-root.sh
Harald Hoyer 414eba
         inst_hook initqueue/finished 01 ./finished-false.sh
Harald Hoyer 414eba
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh
Harald Hoyer 414eba
index e6157af..d9ba45e 100755
Harald Hoyer 414eba
--- a/test/TEST-50-MULTINIC/client-init.sh
Harald Hoyer 414eba
+++ b/test/TEST-50-MULTINIC/client-init.sh
Harald Hoyer 414eba
@@ -1,4 +1,100 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
+getcmdline() {
Harald Hoyer 414eba
+    while read -r _line || [ -n "$_line" ]; do
Harald Hoyer 414eba
+        printf "%s" "$line"
Harald Hoyer 414eba
+    done 
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+_dogetarg() {
Harald Hoyer 414eba
+    local _o _val _doecho
Harald Hoyer 414eba
+    unset _val
Harald Hoyer 414eba
+    unset _o
Harald Hoyer 414eba
+    unset _doecho
Harald Hoyer 414eba
+    CMDLINE=$(getcmdline)
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+    for _o in $CMDLINE; do
Harald Hoyer 414eba
+        if [ "${_o%%=*}" = "${1%%=*}" ]; then
Harald Hoyer 414eba
+            if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
Harald Hoyer 414eba
+                # if $1 has a "=<value>", we want the exact match
Harald Hoyer 414eba
+                if [ "$_o" = "$1" ]; then
Harald Hoyer 414eba
+                    _val="1";
Harald Hoyer 414eba
+                    unset _doecho
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            if [ "${_o#*=}" = "$_o" ]; then
Harald Hoyer 414eba
+                # if cmdline argument has no "=<value>", we assume "=1"
Harald Hoyer 414eba
+                _val="1";
Harald Hoyer 414eba
+                unset _doecho
Harald Hoyer 414eba
+                continue
Harald Hoyer 414eba
+            fi
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+            _val="${_o#*=}"
Harald Hoyer 414eba
+            _doecho=1
Harald Hoyer 414eba
+        fi
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    if [ -n "$_val" ]; then
Harald Hoyer 414eba
+        [ "x$_doecho" != "x" ] && echo "$_val";
Harald Hoyer 414eba
+        return 0;
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 1;
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getarg() {
Harald Hoyer 414eba
+    local _deprecated _newoption
Harald Hoyer 414eba
+    while [ $# -gt 0 ]; do
Harald Hoyer 414eba
+        case $1 in
Harald Hoyer 414eba
+            -d) _deprecated=1; shift;;
Harald Hoyer 414eba
+            -y) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    echo 1
Harald Hoyer 414eba
+                    return 0
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            -n) if _dogetarg $2 >/dev/null; then
Harald Hoyer 414eba
+                    echo 0;
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 1
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift 2;;
Harald Hoyer 414eba
+            *)  if [ -z "$_newoption" ]; then
Harald Hoyer 414eba
+                    _newoption="$1"
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                if _dogetarg $1; then
Harald Hoyer 414eba
+                    if [ "$_deprecated" = "1" ]; then
Harald Hoyer 414eba
+                        [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
Harald Hoyer 414eba
+                    fi
Harald Hoyer 414eba
+                    return 0;
Harald Hoyer 414eba
+                fi
Harald Hoyer 414eba
+                _deprecated=0
Harald Hoyer 414eba
+                shift;;
Harald Hoyer 414eba
+        esac
Harald Hoyer 414eba
+    done
Harald Hoyer 414eba
+    return 1
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
+getargbool() {
Harald Hoyer 414eba
+    local _b
Harald Hoyer 414eba
+    unset _b
Harald Hoyer 414eba
+    local _default
Harald Hoyer 414eba
+    _default="$1"; shift
Harald Hoyer 414eba
+    _b=$(getarg "$@")
Harald Hoyer 414eba
+    [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
Harald Hoyer 414eba
+    if [ -n "$_b" ]; then
Harald Hoyer 414eba
+        [ $_b = "0" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "no" ] && return 1
Harald Hoyer 414eba
+        [ $_b = "off" ] && return 1
Harald Hoyer 414eba
+    fi
Harald Hoyer 414eba
+    return 0
Harald Hoyer 414eba
+}
Harald Hoyer 414eba
+
Harald Hoyer 414eba
 exec >/dev/console 2>&1
Harald Hoyer 414eba
 set -x
Harald Hoyer 414eba
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer 414eba
@@ -20,5 +116,5 @@ done
Harald Hoyer 414eba
     echo "$IFACES"
Harald Hoyer 414eba
 } > /dev/sda
Harald Hoyer 414eba
 
Harald Hoyer 414eba
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 414eba
+getargbool 0 rd.shell && sh -i
Harald Hoyer 414eba
 poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-50-MULTINIC/hard-off.sh b/test/TEST-50-MULTINIC/hard-off.sh
Harald Hoyer 414eba
index 12c3d5a..01acb19 100755
Harald Hoyer 414eba
--- a/test/TEST-50-MULTINIC/hard-off.sh
Harald Hoyer 414eba
+++ b/test/TEST-50-MULTINIC/hard-off.sh
Harald Hoyer 414eba
@@ -1,3 +1,3 @@
Harald Hoyer 414eba
 #!/bin/sh
Harald Hoyer 414eba
-getarg rd.shell || poweroff -f
Harald Hoyer 414eba
-getarg failme && poweroff -f
Harald Hoyer 414eba
+getargbool 0 rd.shell || poweroff -f
Harald Hoyer 414eba
+getargbool 0 failme && poweroff -f
Harald Hoyer 414eba
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
Harald Hoyer 414eba
index e0bf7d2..656c237 100755
Harald Hoyer 414eba
--- a/test/TEST-50-MULTINIC/test.sh
Harald Hoyer 414eba
+++ b/test/TEST-50-MULTINIC/test.sh
Harald Hoyer 414eba
@@ -54,7 +54,7 @@ client_test() {
Harald Hoyer 414eba
         -net nic,macaddr=52:54:00:12:34:$mac2,model=e1000 \
Harald Hoyer 414eba
         -net nic,macaddr=52:54:00:12:34:$mac3,model=e1000 \
Harald Hoyer 414eba
         -watchdog i6300esb -watchdog-action poweroff \
Harald Hoyer 414eba
-        -append "$cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
Harald Hoyer 414eba
+        -append "rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
Harald Hoyer 414eba
         -initrd "$TESTDIR"/initramfs.testing
Harald Hoyer 414eba
 
Harald Hoyer 414eba
     { read OK; read IFACES; } < "$TESTDIR"/client.img
Harald Hoyer 414eba
@@ -270,6 +270,7 @@ test_setup() {
Harald Hoyer 414eba
         . "$basedir"/dracut-init.sh
Harald Hoyer 414eba
         inst_multiple poweroff shutdown
Harald Hoyer 414eba
         inst_hook shutdown-emergency 000 ./hard-off.sh
Harald Hoyer 414eba
+        inst_hook emergency 000 ./hard-off.sh
Harald Hoyer 414eba
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer 414eba
     )
Harald Hoyer 414eba