summaryrefslogtreecommitdiff
path: root/debian/shim-signed.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/shim-signed.postinst')
-rw-r--r--debian/shim-signed.postinst45
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/shim-signed.postinst b/debian/shim-signed.postinst
new file mode 100644
index 0000000..89d445d
--- /dev/null
+++ b/debian/shim-signed.postinst
@@ -0,0 +1,45 @@
+#! /bin/sh
+set -e
+
+# Must load the confmodule for our template to be installed correctly.
+. /usr/share/debconf/confmodule
+
+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
+ triggered)
+ SHIM_NOTRIGGER=y update-secureboot-policy
+ ;;
+ configure)
+ bootloader_id="$(config_item GRUB_DISTRIBUTOR | tr A-Z a-z | \
+ cut -d' ' -f1)"
+ case $bootloader_id in
+ kubuntu) bootloader_id=ubuntu ;;
+ esac
+ if [ "$bootloader_id" ] && [ -d "/boot/efi/EFI/$bootloader_id" ] \
+ && which grub-install >/dev/null 2>&1
+ then
+ grub-install --target=x86_64-efi
+ if dpkg --compare-versions "$2" lt-nl "1.22~"; then
+ rm -f /boot/efi/EFI/ubuntu/MokManager.efi
+ fi
+ fi
+
+ SHIM_NOTRIGGER=y update-secureboot-policy
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0