#!/bin/sh -e

kernel='KERNEL'

case "$0-$1" in
*.postinst-configure)
	rm -f /boot/$kernel.efi.signed
	cp /boot/$kernel /boot/$kernel.efi.signed
	sbattach --attach /usr/lib/linux/$kernel.efi.signature /boot/$kernel.efi.signed
	
	if which update-grub >/dev/null 2>&1; then
		update-grub || true
	fi
	;;
*.postrm-remove)
	rm -f /boot/$kernel.efi.signed

	if which update-grub >/dev/null 2>&1; then
		update-grub || true
	fi
	;;
esac

#DEBHELPER#

exit 0
