File kdump-run-mkinitrd-if-fadump-is-active.patch of Package kdump.21349

From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 20 Apr 2018 17:54:19 +0200
Subject: Run mkinitrd if fadump is active
References: bsc#1089917
Upstream: merged
Git-commit: a25562cb0ff7d2b6d6df2dded8bd29c2e4d7e9ea

With fadump, the default initrd is used. It is better to call the
normal mkinitrd script to achieve consistent behaviour between
updates triggered by kdump and other changes that may require a
rebuild of the initrd.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 init/mkdumprd |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -117,6 +117,25 @@ function run_mkinitrd()
 }                                                                          # }}}
 
 #
+# Create a new fadump initrd using mkinitrd                                  {{{
+function run_mkinitrd_fadump()
+{
+    # With fadump, we have no control over which kernel will be booted
+    # to save the dump, so do not add any versions here.
+    MKINITRD_ARGS=""
+
+    #
+    # if -q is specified, don't print mkinitrd output
+    if (( $QUIET )) ; then
+	MKINITRD_ARGS="$MKINITRD_ARGS &>/dev/null"
+    fi
+
+    status_message "Calling mkinitrd $MKINITRD_ARGS"
+    echo "Regenerating initrd ..." >&2
+    eval "bash -$- /sbin/mkinitrd $MKINITRD_ARGS"
+}                                                                          # }}}
+
+#
 # Create a new initrd using dracut                                           {{{
 function run_dracut()
 {
@@ -219,7 +238,11 @@ if (( ! $FORCE )) ; then
 fi
 
 if [ -e $DRACUT ] ; then
-    run_dracut
+    if [ "$KDUMP_FADUMP" = "yes" ] ; then
+        run_mkinitrd_fadump
+    else
+        run_dracut
+    fi
     ret=$?
 else
     run_mkinitrd
openSUSE Build Service is sponsored by