Blame SOURCES/0081-base-dracut-lib.sh-halt-the-machine-in-systemd-mode-.patch

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