#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
>/dev/watchdog
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-if strstr "$CMDLINE" "rd.shell"; then
+if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
-m 256M -smp 2 -nographic \
-net none \
-watchdog i6300esb -watchdog-action poweroff \
- -append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 $DEBUGFAIL" \
+ -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" \
-initrd $TESTDIR/initramfs.testing || return 1
grep -F -m 1 -q dracut-root-block-success $TESTDIR/result || return 1
}
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
+
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
+
+
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-if strstr "$CMDLINE" "rd.shell"; then
+if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-m 256M -smp 2 -nographic \
-net none \
- -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" \
+ -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" \
-initrd $TESTDIR/initramfs.testing
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
}
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
>/dev/watchdog
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-if strstr "$CMDLINE" "rd.shell"; then
+if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
-m 256M -smp 2 -nographic \
-net none \
-watchdog i6300esb -watchdog-action poweroff \
- -append "root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
+ -append "root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
if (($? != 0)); then
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
>/dev/watchdog
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-if strstr "$CMDLINE" "rd.shell"; then
+if getargbool 0 rd.shell; then
# while sleep 1; do sleep 1;done
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
-drive format=raw,index=2,media=disk,file=$TESTDIR/result \
-m 256M -smp 2 -nographic \
-net none \
- -append "root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT $DEBUGFAIL" \
+ -append "root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
if (($? != 0)); then
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
command -v plymouth >/dev/null && plymouth --quit
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
echo "Powering down."
mount -n -o remount,ro /
#echo " rd.break=shutdown " >> /run/initramfs/etc/cmdline
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
-m 256M -smp 2 -nographic \
-net none \
- -append "root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
+ -append "root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
}
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
mkdir -p $initdir/etc
echo "testluks UUID=$ID_FS_UUID /etc/key" > $initdir/etc/crypttab
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
plymouth --quit
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-m 256M -smp 2 -nographic \
-net none \
- -append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
+ -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" \
-initrd $TESTDIR/initramfs.testing
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1
}
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-! getarg rd.break && getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+! getargbool 0 rd.break && getargbool 0 failme && poweroff -f
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
command -v plymouth >/dev/null && plymouth --quit
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
echo "Powering down."
mount -n -o remount,ro /
#echo " rd.break=shutdown " >> /run/initramfs/etc/cmdline
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img.new \
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img.new \
-net none \
- -append "$* root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL " \
+ -append "$* root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL " \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
echo "CLIENT TEST END: $@ [FAIL]"
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
mkdir -p $initdir/etc
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
-m 256M -smp 2 -nographic \
-net none \
- -append "root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS $DEBUGFAIL" \
+ -append "root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img || return 1
echo "CLIENT TEST END: [OK]"
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
mkdir -p $initdir/etc
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
-m 256M -nographic \
-net none \
- -append "$* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \
+ -append "$* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
echo "CLIENT TEST END: $@ [FAIL]"
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
-m 256M -smp 2 -nographic \
-net none \
- -append "root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
+ -append "root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
dd if=$DISKIMAGE bs=512 count=4 skip=2048 | grep -F -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
}
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
#!/bin/sh
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
-m 256M -smp 2 \
-nographic \
-net none \
- -append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
+ -append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
-initrd "$TESTDIR"/initramfs.testing
# mediacheck test with qemu GUI
. "$basedir"/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
#!/bin/sh
-getarg rd.shell || poweroff -f
+getargbool 0 rd.shell || poweroff -f
getarg failme && poweroff -f
#!/bin/sh
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
stty sane
echo "made it to the rootfs!"
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
echo "Powering down."
mount -n -o remount,ro /
poweroff -f
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-m 256M -smp 2 -nographic \
-net none \
- -append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
+ -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" \
-initrd $TESTDIR/initramfs.testing
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1
}
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
export TERM=linux
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
stty sane
-if strstr "$CMDLINE" "rd.shell"; then
+if getargbool 0 rd.shell; then
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
-net nic,macaddr=$mac,model=e1000 \
-net socket,connect=127.0.0.1:12320 \
-watchdog i6300esb -watchdog-action poweroff \
- -append "$cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet ro console=ttyS0,115200n81 selinux=0" \
+ -append "rd.shell=0 $cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet ro console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.testing
if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nfs-OK $TESTDIR/client.img; then
mkdir $TESTDIR/overlay
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
#!/bin/sh
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
break
done < /proc/mounts
#sh -i
-if strstr "$CMDLINE" "rd.shell"; then
+if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
- -append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
+ -append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
-nographic \
-net nic,macaddr=$mac,model=e1000 \
-net socket,connect=127.0.0.1:12340 \
- -append "$cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \
+ -append "rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \
-initrd $TESTDIR/initramfs.testing
if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nbd-OK $TESTDIR/flag.img; then
)
inst_multiple mke2fs poweroff cp umount tune2fs
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
#!/bin/sh
+getcmdline() {
+ while read -r _line || [ -n "$_line" ]; do
+ printf "%s" "$line"
+ done </proc/cmdline;
+}
+
+_dogetarg() {
+ local _o _val _doecho
+ unset _val
+ unset _o
+ unset _doecho
+ CMDLINE=$(getcmdline)
+
+ for _o in $CMDLINE; do
+ if [ "${_o%%=*}" = "${1%%=*}" ]; then
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
+ # if $1 has a "=<value>", we want the exact match
+ if [ "$_o" = "$1" ]; then
+ _val="1";
+ unset _doecho
+ fi
+ continue
+ fi
+
+ if [ "${_o#*=}" = "$_o" ]; then
+ # if cmdline argument has no "=<value>", we assume "=1"
+ _val="1";
+ unset _doecho
+ continue
+ fi
+
+ _val="${_o#*=}"
+ _doecho=1
+ fi
+ done
+ if [ -n "$_val" ]; then
+ [ "x$_doecho" != "x" ] && echo "$_val";
+ return 0;
+ fi
+ return 1;
+}
+
+getarg() {
+ local _deprecated _newoption
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -d) _deprecated=1; shift;;
+ -y) if _dogetarg $2 >/dev/null; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
+ fi
+ echo 1
+ return 0
+ fi
+ _deprecated=0
+ shift 2;;
+ -n) if _dogetarg $2 >/dev/null; then
+ echo 0;
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
+ fi
+ return 1
+ fi
+ _deprecated=0
+ shift 2;;
+ *) if [ -z "$_newoption" ]; then
+ _newoption="$1"
+ fi
+ if _dogetarg $1; then
+ if [ "$_deprecated" = "1" ]; then
+ [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
+ fi
+ return 0;
+ fi
+ _deprecated=0
+ shift;;
+ esac
+ done
+ return 1
+}
+
+getargbool() {
+ local _b
+ unset _b
+ local _default
+ _default="$1"; shift
+ _b=$(getarg "$@")
+ [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
+ if [ -n "$_b" ]; then
+ [ $_b = "0" ] && return 1
+ [ $_b = "no" ] && return 1
+ [ $_b = "off" ] && return 1
+ fi
+ return 0
+}
+
exec >/dev/console 2>&1
set -x
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
echo "$IFACES"
} > /dev/sda
-strstr "$CMDLINE" "rd.shell" && sh -i
+getargbool 0 rd.shell && sh -i
poweroff -f
#!/bin/sh
-getarg rd.shell || poweroff -f
-getarg failme && poweroff -f
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
-net nic,macaddr=52:54:00:12:34:$mac2,model=e1000 \
-net nic,macaddr=52:54:00:12:34:$mac3,model=e1000 \
-watchdog i6300esb -watchdog-action poweroff \
- -append "$cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
+ -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" \
-initrd "$TESTDIR"/initramfs.testing
{ read OK; read IFACES; } < "$TESTDIR"/client.img
. "$basedir"/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)