kexec-tools/60-fadump.install
Lichen Liu fb93b28df8 fadump: add a kernel install hook to clean up fadump initramfs
Resolves: bz2139000
Upstream: Fedora
Conflict: Upstream doesn't have Source37: supported-kdump-targets.txt,
so the number of SourceXX need to be changed.

commit 4a2dcab26a
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Fri Dec 2 18:46:51 2022 +0530

    fadump: add a kernel install hook to clean up fadump initramfs

    Kdump service will create fadump initramfs when needed, but it won't
    clean up the fadump initramfs on kernel uninstall. So create a kernel
    install hook to do the clean up job.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2022-12-22 14:36:23 +08:00

32 lines
632 B
Bash
Executable File

#!/usr/bin/bash
COMMAND="$1"
KERNEL_VERSION="$2"
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
# Currently, fadump is supported only in environments with
# writable /boot directory.
if [[ ! -w "/boot" ]]; then
exit 0
fi
FADUMP_INITRD="/boot/.initramfs-${KERNEL_VERSION}.img.default"
FADUMP_INITRD_CHECKSUM="$FADUMP_INITRD.checksum"
ret=0
case "$COMMAND" in
add)
# Do nothing, fadump initramfs is strictly host only
# and managed by kdump service
;;
remove)
rm -f -- "$FADUMP_INITRD"
rm -f -- "$FADUMP_INITRD_CHECKSUM"
ret=$?
;;
esac
exit $ret