From e9088ae71a0fec5505b2db7e814a8c84d5137b84 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Mon, 19 Sep 2022 09:07:25 +0800 Subject: [PATCH] remove useless --zipl when calling grubby to update kernel command line Related: bz2104534 Upstream: Fedora Conflict: None commit 58eef4582a5ec060a51a699839868d5b86fa2b05 Author: Coiby Xu Date: Tue Jul 12 16:07:37 2022 +0800 remove useless --zipl when calling grubby to update kernel command line "grubby --zipl" only takes effect when setting default kernel. It's useless to add "--zipl" when updating kernel command line. Also rename _update_grub to _update_kernel_cmdline since s390x doesn't use GRUB. Reviewed-by: Philipp Rudo Signed-off-by: Coiby Xu Signed-off-by: Coiby Xu --- kdumpctl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kdumpctl b/kdumpctl index 104574b..84841bd 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1389,7 +1389,7 @@ _get_current_running_kernel_path() fi } -_update_grub() +_update_kernel_cmdline() { local _kernel_path=$1 _crashkernel=$2 _dump_mode=$3 _fadump_val=$4 @@ -1400,15 +1400,14 @@ _update_grub() rpm-ostree kargs --append="crashkernel=$_crashkernel" fi else - [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl" - grubby --args "crashkernel=$_crashkernel" --update-kernel "$_kernel_path" $zipl_arg + grubby --args "crashkernel=$_crashkernel" --update-kernel "$_kernel_path" if [[ $_dump_mode == kdump ]]; then grubby --remove-args="fadump" --update-kernel "$_kernel_path" else grubby --args="fadump=$_fadump_val" --update-kernel "$_kernel_path" fi fi - [[ $zipl_arg ]] && zipl > /dev/null + [[ -f /etc/zipl.conf ]] && zipl > /dev/null } _valid_grubby_kernel_path() @@ -1538,7 +1537,7 @@ reset_crashkernel() _new_dump_mode=kdump _new_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_new_dump_mode") if [[ $_old_crashkernel != "$_new_crashkernel" ]]; then - _update_grub "" "$_new_crashkernel" "$_new_dump_mode" "" + _update_kernel_cmdline "" "$_new_crashkernel" "$_new_dump_mode" "" if [[ $_reboot == yes ]]; then systemctl reboot fi @@ -1606,7 +1605,7 @@ reset_crashkernel() _old_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel) _old_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump) if [[ $_old_crashkernel != "$_new_crashkernel" || $_old_fadump_val != "$_new_fadump_val" ]]; then - _update_grub "$_kernel" "$_new_crashkernel" "$_new_dump_mode" "$_new_fadump_val" + _update_kernel_cmdline "$_kernel" "$_new_crashkernel" "$_new_dump_mode" "$_new_fadump_val" if [[ $_reboot != yes ]]; then if [[ $_old_crashkernel != "$_new_crashkernel" ]]; then _what_is_updated="Updated crashkernel=$_new_crashkernel" @@ -1675,7 +1674,7 @@ reset_crashkernel_after_update() if [[ $_crashkernel == "$_old_default_crashkernel" ]] && [[ $_new_default_crashkernel != "$_old_default_crashkernel" ]]; then _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump) - if _update_grub "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then + if _update_kernel_cmdline "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then echo "For kernel=$_kernel, crashkernel=$_new_default_crashkernel now." fi fi @@ -1731,7 +1730,7 @@ reset_crashkernel_for_installed_kernel() _fadump_val_running=$(get_grub_kernel_boot_parameter "$_kernel" fadump) if [[ $_crashkernel != "$_crashkernel_running" ]]; then - if _update_grub "$_installed_kernel" "$_crashkernel_running" "$_dump_mode_running" "$_fadump_val_running"; then + if _update_kernel_cmdline "$_installed_kernel" "$_crashkernel_running" "$_dump_mode_running" "$_fadump_val_running"; then echo "kexec-tools has reset $_installed_kernel to use the new default crashkernel value $_crashkernel_running" fi fi