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