File kdump-include-hosts-and-nsswitch-in-kdumprd.patch of Package kdump

From: Roberto Sassu <rsassu@suse.com>
Date: Fri Sep 16 19:57:05 2016 +0200
Subject: Refresh kdumprd if /etc/hosts or /etc/nsswitch.conf is changed
References: bsc#943214
Patch-mainline: v0.8.16
Git-commit: e727e727bb9471b8efe602193a4d71930728d75e

These files may be necessary to resolve the dump target host, so let's
include them in the initrd, and also update the initrd image if they
are changed.

Signed-off-by: Roberto Sassu <rsassu@suse.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>

---
 init/mkdumprd |    5 +++++
 1 file changed, 5 insertions(+)

--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -142,6 +142,9 @@ function run_dracut()
     # Make resolved variables visible to the dracut module
     kdump_export_targets
 
+    # Include additional files in the kdump initial ram disk
+    DRACUT_ARGS="$DRACUT_ARGS --install '/etc/hosts /etc/nsswitch.conf'"
+
     DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
     echo "Regenerating kdump initrd ..." >&2
     eval "bash -$- $DRACUT $DRACUT_ARGS"
@@ -224,6 +227,8 @@ if (( ! $FORCE )) ; then
             [ "$KDUMP_CONFIG" -ot "$INITRD" ] && \
             [ /root/.ssh/id_dsa.pub -ot "$INITRD" ] && \
             [ /root/.ssh/id_dsa -ot "$INITRD" ] && \
+            [ /etc/hosts -ot "$INITRD" ] && \
+            [ /etc/nsswitch.conf -ot "$INITRD" ] && \
             [ "$KERNEL" -ot "$INITRD" ] ; then
         status_message "Not regenerating kdump initrd. Use mkdumprd -f to force regeneration."
         exit 0
openSUSE Build Service is sponsored by