dracut/0162-Revert-Change-the-implementation-of-action_on_fail.patch
Harald Hoyer bb31e7fe65 dracut-043-172.git20151113
- git snapshot
2015-11-13 16:51:52 +01:00

98 lines
3.5 KiB
Diff

From 74c9fb947b265f30f4190ce77269ec0cd0e73925 Mon Sep 17 00:00:00 2001
From: "dyoung@redhat.com" <dyoung@redhat.com>
Date: Mon, 31 Aug 2015 10:43:15 +0800
Subject: [PATCH] Revert "Change the implementation of action_on_fail"
This reverts commit d2765b5175663d094737d6819cc3f3df53e7a4cb.
action_on_fail is useless thus remove the commits for it one by one.
Signed-off-by: Dave Young <dyoung@redhat.com>
---
dracut.cmdline.7.asc | 4 ++++
.../98dracut-systemd/dracut-emergency.service | 2 +-
modules.d/98dracut-systemd/emergency.service | 2 +-
modules.d/99base/dracut-lib.sh | 28 ++++++++++++++--------
4 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index d790afd..ad99799 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -159,6 +159,10 @@ Misc
specify the controlling terminal for the console.
This is useful, if you have multiple "console=" arguments.
+**rd.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/98dracut-systemd/dracut-emergency.service b/modules.d/98dracut-systemd/dracut-emergency.service
index 5a6d525..a4b81bc 100644
--- a/modules.d/98dracut-systemd/dracut-emergency.service
+++ b/modules.d/98dracut-systemd/dracut-emergency.service
@@ -13,7 +13,7 @@ DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
Conflicts=emergency.service emergency.target
-ConditionPathExists=!/lib/dracut/no-emergency-shell
+ConditionKernelCommandLine=!action_on_fail=continue
[Service]
Environment=HOME=/
diff --git a/modules.d/98dracut-systemd/emergency.service b/modules.d/98dracut-systemd/emergency.service
index 5f1eaa2..c19fe37 100644
--- a/modules.d/98dracut-systemd/emergency.service
+++ b/modules.d/98dracut-systemd/emergency.service
@@ -12,7 +12,7 @@ Description=Emergency Shell
DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
-ConditionPathExists=!/lib/dracut/no-emergency-shell
+ConditionKernelCommandLine=!action_on_fail=continue
[Service]
Environment=HOME=/
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 03a283c..cc5bb42 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1143,16 +1143,24 @@ emergency_shell()
action_on_fail()
{
- if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
- [ "$1" = "-n" ] && shift 2
- [ "$1" = "--shutdown" ] && shift 2
- warn "$*"
- warn "Not dropping to emergency shell, because $initdir/lib/dracut/no-emergency-shell exists."
- return 0
- fi
-
- emergency_shell $@
- return 1
+ local _action=$(getarg rd.action_on_fail= -d 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