#! /bin/sh

set -e

case "$1" in
  remove|abort-install|disappear)
	dpkg-divert --package proxmox-kernel-helper --remove --rename \
           --divert /usr/sbin/grub-install.real /usr/sbin/grub-install
    ;;
  abort-upgrade)
       if [ -n "$2" ]; then
           if dpkg --compare-versions "$2" lt "6.4-1~"; then
               dpkg-divert --package proxmox-kernel-helper --remove --rename \
                   --divert /usr/sbin/grub-install.real /usr/sbin/grub-install
           fi
       fi
  ;;
esac

# Automatically added by dh_installdeb/13.11.4
dpkg-maintscript-helper mv_conffile /etc/initramfs/post-update.d/pve-efiboot-sync /etc/initramfs/post-update.d/proxmox-boot-sync 6.4-1\~ pve-kernel-helper -- "$@"
dpkg-maintscript-helper mv_conffile /etc/kernel/postinst.d/pve-auto-removal /etc/kernel/postinst.d/proxmox-auto-removal 6.4-1\~ pve-kernel-helper -- "$@"
dpkg-maintscript-helper mv_conffile /etc/kernel/postinst.d/zz-pve-efiboot /etc/kernel/postinst.d/zz-proxmox-boot 6.4-1\~ pve-kernel-helper -- "$@"
dpkg-maintscript-helper mv_conffile /etc/kernel/postrm.d/pve-auto-removal /etc/kernel/postrm.d/proxmox-auto-removal 6.4-1\~ pve-kernel-helper -- "$@"
dpkg-maintscript-helper mv_conffile /etc/kernel/postrm.d/zz-pve-efiboot /etc/kernel/postrm.d/zz-proxmox-boot 6.4-1\~ pve-kernel-helper -- "$@"
# End automatically added section
# Automatically added by dh_installsystemd/13.11.4
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.11.4
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'proxmox-boot-cleanup.service' >/dev/null || true
	fi
fi
# End automatically added section


exit 0
