File 0555-Avoid-executing-emergency-hooks-twice.patch of Package dracut.12460

From 64511ab0b73df0c9d704e61b14beba641818dd56 Mon Sep 17 00:00:00 2001
From: Ignaz Forster <iforster@suse.com>
Date: Tue, 6 Feb 2018 17:32:47 +0100
Subject: [PATCH] Avoid executing emergency hooks twice

When using systemd emergency hooks were executed twice; this patch will avoid
that by only calling the hook of systemd is not called anyway.
Also see https://github.com/dracutdevs/dracut/pull/374
---
 modules.d/99base/dracut-lib.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: dracut-044/modules.d/99base/dracut-lib.sh
===================================================================
--- dracut-044.orig/modules.d/99base/dracut-lib.sh
+++ dracut-044/modules.d/99base/dracut-lib.sh
@@ -1072,6 +1072,7 @@ _emergency_shell()
         rm -f -- /.console_lock
     else
         debug_off
+        source_hook "$hook"
         echo
         /sbin/rdsosreport
         echo 'You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot'
@@ -1122,12 +1123,12 @@ emergency_shell()
 
     echo ; echo
     warn "$*"
-    source_hook "$hook"
     echo
 
     if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
         _emergency_shell $_rdshell_name
     else
+        source_hook "$hook"
         warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
         # cause a kernel panic
         exit 1