a56a5e
From 779f980658ab223773ef065ac3f833aacd374c53 Mon Sep 17 00:00:00 2001
966cef
From: Harald Hoyer <harald@redhat.com>
966cef
Date: Fri, 17 Jan 2014 15:27:47 +0100
966cef
Subject: [PATCH] base/dracut-lib.sh: "halt" the machine in systemd mode for
966cef
 die()
966cef
966cef
and only go in emergency shell if "rd.debug" is specified
966cef
966cef
https://bugzilla.redhat.com/show_bug.cgi?id=1053655
966cef
---
966cef
 modules.d/99base/dracut-lib.sh | 19 ++++++++++++++++---
966cef
 1 file changed, 16 insertions(+), 3 deletions(-)
966cef
966cef
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
1755ca
index a3476ab3..e74b93fa 100755
966cef
--- a/modules.d/99base/dracut-lib.sh
966cef
+++ b/modules.d/99base/dracut-lib.sh
966cef
@@ -1,4 +1,4 @@
966cef
-#!/bin/sh
966cef
+!/bin/sh
966cef
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
966cef
 # ex: ts=8 sw=4 sts=4 et filetype=sh
966cef
 
966cef
@@ -430,8 +430,15 @@ die() {
966cef
         echo "warn dracut: Refusing to continue";
966cef
     } >> $hookdir/emergency/01-die.sh
966cef
     [ -d /run/initramfs ] || mkdir -p -- /run/initramfs
966cef
+
966cef
     > /run/initramfs/.die
966cef
-    emergency_shell
966cef
+
966cef
+    getargbool 0 "rd.debug=" && emergency_shell
966cef
+
966cef
+    if [ -n "$DRACUT_SYSTEMD" ]; then
966cef
+        systemctl --no-block --force halt
966cef
+    fi
966cef
+
966cef
     exit 1
966cef
 }
966cef
 
966cef
@@ -1045,7 +1052,13 @@ emergency_shell()
966cef
         # cause a kernel panic
966cef
         exit 1
966cef
     fi
966cef
-    [ -e /run/initramfs/.die ] && exit 1
966cef
+
966cef
+    if [ -e /run/initramfs/.die ]; then
966cef
+        if [ -n "$DRACUT_SYSTEMD" ]; then
966cef
+            systemctl --no-block --force halt
966cef
+        fi
966cef
+        exit 1
966cef
+    fi
966cef
 }
966cef
 
966cef
 action_on_fail()