When the user runs "kdumpctl reset-crashkernel CRASHKERNEL", CRASHKERNEL
will be written to /etc/kdump.conf.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdump-lib-initramfs.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c1fd75f..cfef3ce 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -24,6 +24,15 @@ kdump_get_conf_val()
sed -n -e "/^\s*\($1\)\s\+/{s/^\s*\($1\)\s\+//;s/#.*//;s/\s*$//;h};\${x;p}"
$KDUMP_CONFIG_FILE
}
+# write config value to kdump.conf
+# $1: config name, sed regexp compatible
+# $2: config value
+kdump_write_conf_val()
+{
+ [ -f "$KDUMP_CONFIG_FILE" ] &&
+ sed -i -e "s/\(^\s*$1\)\(\s\+\).*/\1\2$2/g" $KDUMP_CONFIG_FILE
+}
+
is_mounted()
{
findmnt -k -n "$1" > /dev/null 2>&1
--
2.31.1