#!/usr/bin/bash
# /etc/kernel/postrm.d/zz-lamboot
# Called by dpkg after a kernel is removed.
# Arguments: KERNEL_VERSION

[ -x /usr/local/bin/lamboot-kernel-hook ] || exit 0

# Never fail the kernel package: The kernel's maintainer scripts run this
# directory with run-parts --exit-on-error, so a failure here would leave the
# kernel unconfigured and skip the hooks after it (zz-update-grub among them),
# as zzzz-lamboot-proxmox already avoids. lamboot-kernel-hook says why it failed.
/usr/local/bin/lamboot-kernel-hook remove "$@" \
    || echo "zz-lamboot: LamBoot's entries weren't updated for the removed kernel; run lamboot-install --update" >&2
exit 0
