Blob Blame History Raw
From 9a222e393afe093b5e940679e13b8bf5c2fb16a3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 17 Jan 2014 15:27:47 +0100
Subject: [PATCH] base/dracut-lib.sh: "halt" the machine in systemd mode for
 die()

and only go in emergency shell if "rd.debug" is specified

https://bugzilla.redhat.com/show_bug.cgi?id=1053655
---
 modules.d/99base/dracut-lib.sh | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index a3476ab..e74b93f 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+!/bin/sh
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
@@ -430,8 +430,15 @@ die() {
         echo "warn dracut: Refusing to continue";
     } >> $hookdir/emergency/01-die.sh
     [ -d /run/initramfs ] || mkdir -p -- /run/initramfs
+
     > /run/initramfs/.die
-    emergency_shell
+
+    getargbool 0 "rd.debug=" && emergency_shell
+
+    if [ -n "$DRACUT_SYSTEMD" ]; then
+        systemctl --no-block --force halt
+    fi
+
     exit 1
 }
 
@@ -1045,7 +1052,13 @@ emergency_shell()
         # cause a kernel panic
         exit 1
     fi
-    [ -e /run/initramfs/.die ] && exit 1
+
+    if [ -e /run/initramfs/.die ]; then
+        if [ -n "$DRACUT_SYSTEMD" ]; then
+            systemctl --no-block --force halt
+        fi
+        exit 1
+    fi
 }
 
 action_on_fail()