From 45e02e73fa265452d90c552f82b95f1bde3ea45b Mon Sep 17 00:00:00 2001 From: "onitsuka.shinic@fujitsu.com" Date: Fri, 5 Jun 2020 02:25:12 +0000 Subject: [PATCH] dracut-kdump.sh: Execute the binary and script filesin /etc/kdump/{pre.d,post.d} This patch executes the binary and script files in /etc/kdump/{pre.d,post.d} just like kdump_pre or kdump_post directive written in /etc/kdump.conf. Signed-off-by: Shinichi Onitsuka Acked-by: Pingfan Liu --- dracut-kdump.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 8752178..9c8f3a9 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -30,15 +30,49 @@ do_dump() do_kdump_pre() { + local _ret + if [ -n "$KDUMP_PRE" ]; then "$KDUMP_PRE" + _ret=$? + if [ $_ret -ne 0 ]; then + echo "kdump: $KDUMP_PRE exited with $_ret status" + return $_ret + fi fi + + if [ -d /etc/kdump/pre.d ]; then + for file in /etc/kdump/pre.d/*; do + "$file" + _ret=$? + if [ $_ret -ne 0 ]; then + echo "kdump: $file exited with $_ret status" + fi + done + fi + return 0 } do_kdump_post() { + local _ret + + if [ -d /etc/kdump/post.d ]; then + for file in /etc/kdump/post.d/*; do + "$file" "$1" + _ret=$? + if [ $_ret -ne 0 ]; then + echo "kdump: $file exited with $_ret status" + fi + done + fi + if [ -n "$KDUMP_POST" ]; then "$KDUMP_POST" "$1" + _ret=$? + if [ $_ret -ne 0 ]; then + echo "kdump: $KDUMP_POST exited with $_ret status" + fi fi }