From 687000767464401261f336d118de9bba7f50e88d Mon Sep 17 00:00:00 2001 From: "dyoung@redhat.com" Date: Mon, 31 Aug 2015 10:43:20 +0800 Subject: [PATCH] Revert "Let user specify the action after fail" This reverts commit 9d787df19674937e8c07bd295b5d282a63829209 action_on_fail is useless thus remove the commits for it one by one. Signed-off-by: Dave Young --- dracut.cmdline.7.asc | 4 ---- modules.d/95rootfs-block/mount-root.sh | 2 +- modules.d/98dracut-systemd/dracut-initqueue.sh | 2 +- modules.d/98dracut-systemd/dracut-mount.sh | 2 +- modules.d/98selinux/selinux-loadpolicy.sh | 6 ++++-- modules.d/98usrmount/mount-usr.sh | 4 ++-- modules.d/99base/dracut-lib.sh | 22 ---------------------- modules.d/99base/init.sh | 12 ++++++------ 8 files changed, 15 insertions(+), 39 deletions(-) diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index cd8cc66..d790afd 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -159,10 +159,6 @@ Misc specify the controlling terminal for the console. This is useful, if you have multiple "console=" arguments. -**action_on_fail=**_{shell|continue}_:: - Specify the action after failure. By default it's emergency_shell. - 'continue' means: ignore the current failure and go ahead. - [[dracutkerneldebug]] Debug ~~~~~ diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh index 7e9c5bb..924393b 100755 --- a/modules.d/95rootfs-block/mount-root.sh +++ b/modules.d/95rootfs-block/mount-root.sh @@ -66,7 +66,7 @@ mount_root() { warn "*** Warning -- the system did not shut down cleanly. " warn "*** Dropping you to a shell; the system will continue" warn "*** when you leave the shell." - action_on_fail + emergency_shell fi fsckoptions="$AUTOFSCK_OPT $fsckoptions" fi diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh index 881f639..3ddc236 100755 --- a/modules.d/98dracut-systemd/dracut-initqueue.sh +++ b/modules.d/98dracut-systemd/dracut-initqueue.sh @@ -68,7 +68,7 @@ while :; do main_loop=$(($main_loop+1)) if [ $main_loop -gt $RDRETRY ]; then if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ] ; then - action_on_fail "Could not boot." && break + emergency_shell "Could not boot." fi warn "Not all disks have been found." warn "You might want to regenerate your initramfs." diff --git a/modules.d/98dracut-systemd/dracut-mount.sh b/modules.d/98dracut-systemd/dracut-mount.sh index 11ba7bc..c4febfe 100755 --- a/modules.d/98dracut-systemd/dracut-mount.sh +++ b/modules.d/98dracut-systemd/dracut-mount.sh @@ -29,7 +29,7 @@ while :; do done i=$(($i+1)) - [ $i -gt 20 ] && action_on_fail "Can't mount root filesystem" && break + [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem" done export -p > /dracut-state.sh diff --git a/modules.d/98selinux/selinux-loadpolicy.sh b/modules.d/98selinux/selinux-loadpolicy.sh index d0ac834..ca81a38 100755 --- a/modules.d/98selinux/selinux-loadpolicy.sh +++ b/modules.d/98selinux/selinux-loadpolicy.sh @@ -54,14 +54,16 @@ rd_load_policy() if [ $ret -eq 3 -o $permissive -eq 0 ]; then warn "Machine in enforcing mode." warn "Not continuing" - action_on_fail -n selinux || exit 1 + emergency_shell -n selinux + exit 1 fi return 0 elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then warn "Machine in enforcing mode and cannot execute load_policy." warn "To disable selinux, add selinux=0 to the kernel command line." warn "Not continuing" - action_on_fail -n selinux || exit 1 + emergency_shell -n selinux + exit 1 fi } diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh index d1a629c..1699604 100755 --- a/modules.d/98usrmount/mount-usr.sh +++ b/modules.d/98usrmount/mount-usr.sh @@ -40,7 +40,7 @@ fsck_usr() warn "*** Warning -- the system did not shut down cleanly. " warn "*** Dropping you to a shell; the system will continue" warn "*** when you leave the shell." - action_on_fail + emergency_shell fi _fsckoptions="$AUTOFSCK_OPT $_fsckoptions" fi @@ -103,7 +103,7 @@ mount_usr() warn "Mounting /usr to $NEWROOT/usr failed" warn "*** Dropping you to a shell; the system will continue" warn "*** when you leave the shell." - action_on_fail + emergency_shell fi fi } diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 1ac9b3c..d3a7b59 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -1141,28 +1141,6 @@ emergency_shell() fi } -action_on_fail() -{ - local _action=$(getarg action_on_fail=) - case "$_action" in - continue) - [ "$1" = "-n" ] && shift 2 - [ "$1" = "--shutdown" ] && shift 2 - warn "$*" - warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line." - return 0 - ;; - shell) - emergency_shell $@ - return 1 - ;; - *) - emergency_shell $@ - return 1 - ;; - esac -} - # Retain the values of these variables but ensure that they are unexported # This is a POSIX-compliant equivalent of bash's "export -n" export_n() diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index a59e8ea..e2e4029 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -85,7 +85,7 @@ if command -v kmod >/dev/null 2>/dev/null; then done fi -trap "action_on_fail Signal caught!" 0 +trap "emergency_shell Signal caught!" 0 export UDEVVERSION=$(udevadm --version) if [ $UDEVVERSION -gt 166 ]; then @@ -214,7 +214,7 @@ while :; do main_loop=$(($main_loop+1)) [ $main_loop -gt $RDRETRY ] \ - && { flock -s 9 ; action_on_fail "Could not boot." && break; } 9>/.console_lock + && { flock -s 9 ; emergency_shell "Could not boot."; } 9>/.console_lock done unset job unset queuetriggered @@ -249,7 +249,7 @@ while :; do _i_mount=$(($_i_mount+1)) [ $_i_mount -gt 20 ] \ - && { flock -s 9 ; action_on_fail "Can't mount root filesystem" && break; } 9>/.console_lock + && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock done { @@ -283,7 +283,7 @@ done [ "$INIT" ] || { echo "Cannot find init!" echo "Please check to make sure you passed a valid root filesystem!" - action_on_fail + emergency_shell } if [ $UDEVVERSION -lt 168 ]; then @@ -387,13 +387,13 @@ if [ -f /etc/capsdrop ]; then warn "Command:" warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs warn "failed." - action_on_fail + emergency_shell } else unset RD_DEBUG exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || { warn "Something went very badly wrong in the initramfs. Please " warn "file a bug against dracut." - action_on_fail + emergency_shell } fi