If failed to mount /sysroot, triggering OnFailure= dependencies
of initrd-xxx.service, then dracut-emergency will be started by
systemd and enter into emergency shell.

Here add a judgement in dracut-emergency. If user specify
"action_on_fail=continue", continue though mount root failed.
Otherwise enter into interactive shell.

v1-v2->
      action_on_fail function can't be used directly here, discard
      it. Instead add a judgement to handle this.

Signed-off-by: Baoquan He <[email protected]>
---
 modules.d/98systemd/dracut-emergency.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/modules.d/98systemd/dracut-emergency.sh 
b/modules.d/98systemd/dracut-emergency.sh
index 8ab045e..51e1f80 100755
--- a/modules.d/98systemd/dracut-emergency.sh
+++ b/modules.d/98systemd/dracut-emergency.sh
@@ -30,7 +30,12 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d 
rdbreak; then
     echo
     [ -f /etc/profile ] && . /etc/profile
     [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
-    exec sh -i -l
+    if [ "$(getarg action_on_fail=)" = "continue" ]; then
+        echo "Systemd is starting dracut emergency"
+        echo "NoT dropping to emergency shell, because 
'action_on_fail=continue' was set on kernel command line"
+    else
+        exec sh -i -l
+    fi
 else
     warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to 
the kernel command line."
     exit 1
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to