summaryrefslogtreecommitdiff
path: root/debian/signing-template/@final_pkg_name@.postrm.in
diff options
context:
space:
mode:
Diffstat (limited to 'debian/signing-template/@final_pkg_name@.postrm.in')
-rw-r--r--debian/signing-template/@final_pkg_name@.postrm.in53
1 files changed, 53 insertions, 0 deletions
diff --git a/debian/signing-template/@final_pkg_name@.postrm.in b/debian/signing-template/@final_pkg_name@.postrm.in
new file mode 100644
index 00000000..cd261b15
--- /dev/null
+++ b/debian/signing-template/@final_pkg_name@.postrm.in
@@ -0,0 +1,53 @@
+#! /bin/sh
+set -e
+
+case @arch@ in
+ i386)
+ SHIM_REMOVE="mmia32.efi fbia32.efi";;
+ amd64)
+ SHIM_REMOVE="mmx64.efi fbx64.efi";;
+ arm64)
+ SHIM_REMOVE="mmaa64.efi fbaa64.efi";;
+ *)
+ echo "Unsupported dpkg architecture @arch@ in $0. ABORT"
+ exit 1
+ ;;
+esac
+
+# Pull out a config value from /etc/default/grub
+config_item ()
+{
+ if [ -f /etc/default/grub ]; then
+ . /etc/default/grub || return
+ for x in /etc/default/grub.d/*.cfg; do
+ if [ -e "$x" ]; then
+ . "$x"
+ fi
+ done
+ fi
+ eval echo "\$$1"
+}
+
+case $1 in
+ remove|purge)
+ bootloader_id="$(config_item GRUB_DISTRIBUTOR | tr A-Z a-z | \
+ cut -d' ' -f1)"
+ case $bootloader_id in
+ kubuntu) bootloader_id=ubuntu ;;
+ esac
+
+ # If we're being removed, remove the copies installed in the
+ # ESP. grub-install doesn't clean those up for us.
+ if [ "$bootloader_id" ] && \
+ [ -d "/boot/efi/EFI/$bootloader_id" ] && \
+ [ -d /sys/firmware/efi ]; then
+
+ cd /boot/efi/EFI/$bootloader_id
+ rm -f $SHIM_REMOVE
+ fi
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0