Hi Coiby,
besides the discussion about keeping the crashkernel option.
In my opinion a .conf should be read-only for the tool it is configuring unless there is a dedicated mechanism to manage the config (like 'git config'). But the way I understand you are planning to update silently kdump.conf every time a user runs kdumpctl reset-crashkernel. That's not the behavior I would expect of the script. Ultimately I think I would drop this patch.
Thanks Philipp
On Fri, 19 Nov 2021 11:23:02 +0800 Coiby Xu coxu@redhat.com wrote:
When the user runs "kdumpctl reset-crashkernel CRASHKERNEL", CRASHKERNEL will be written to /etc/kdump.conf.
Signed-off-by: Coiby Xu coxu@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