diff --git a/kexec-tools.spec b/kexec-tools.spec index 48b3889..05e22cf 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -267,8 +267,12 @@ mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/ %pre -# save the old default crashkernel values to /tmp/ when upgrading the package -if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then +# Save the old default crashkernel values to /tmp/ when upgrading the package +# so kdumpctl later can tell if it should update the kernel crashkernel +# parameter in the posttrans scriptlet. Note this feauture of auto-updating +# the kernel crashkernel parameter currently doesn't support ostree, so skip it +# for ostree. +if [ ! -f /run/ostree-booted ] && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null %ifarch ppc64 ppc64le kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null @@ -343,9 +347,14 @@ do done %posttrans -# try to reset kernel crashkernel value to new default value when upgrading -# the package -if ! grep -qs "ostree" /proc/cmdline && [ $1 == 1 ]; then +# Try to reset kernel crashkernel value to new default value based on the old +# default value or set up crasherkernel value for osbuild +# +# Note +# 1. Skip ostree systems as they are not supported. +# 2. "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade. The +# former case is used to set up crashkernel for osbuild +if [ ! -f /run/ostree-booted ] && [ $1 == 1 ]; then kdumpctl reset-crashkernel-after-update rm /tmp/old_default_crashkernel 2>/dev/null %ifarch ppc64 ppc64le