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