Hi Coiby,
On Wed, 16 Feb 2022 14:06:04 +0800
Coiby Xu <coxu(a)redhat.com> wrote:
This function would be used to read kernel cmdline parameter like
fadump
or crashkernel.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 998ac6e..42730cb 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1423,6 +1423,14 @@ _update_kernel_cmdline_in_grub_etc_default()
}" "$GRUB_ETC_DEFAULT"
}
+# read the kernel command line parameter in default grub conf
+#
+# $1: the name of the kernel command line parameter
+_read_kernel_cmdline_in_grub_etc_default()
+{
+ sed -n -E
"s/^GRUB_CMDLINE_LINUX=.*[[:space:]\"]${1}=([^[:space:]\"]*).*$/\1/p"
"$GRUB_ETC_DEFAULT"
+}
+
Similar to the "set" version this one has a problem with boolean
parameters like e.g. quiet. So how about this
# Get the value for $_para set in /etc/default/grub. If $_para is boolean
# return $_para (if it exist). If it is not set return an empty string.
sed -n "/^GRUB_CMDLINE_LINUX=/ {
s/.*\<$_para=\([^[:space:]\"]*\>\).*/\1/p; t;
s/.*\(\<$_para\>\).*/\1/p;
}" "$GRUB_ETC_DEFAULT"
Furthermore, I think you can merge this patch with patch 4. Personally
I don't think there is a benefit in having this in an extra patch.
Thanks
Philipp
reset_crashkernel()
{
local _opt _val _dump_mode _fadump_val _reboot _grubby_kernel_path _kernel _kernels