summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve McIntyre <steve@einval.com>2021-05-03 15:54:46 +0100
committerSteve McIntyre <steve@einval.com>2021-05-03 15:03:14 +0000
commit5f3cdb4f68753cb44cec980b862320f6a0397e2a (patch)
tree4241836c64f654b5af552c2eef2d937fb0e1431b
parent3eddc534b76622dcf15286490a32a63ad713dd6a (diff)
downloadshim-signed-5f3cdb4f68753cb44cec980b862320f6a0397e2a.tar.gz
shim-signed-5f3cdb4f68753cb44cec980b862320f6a0397e2a.zip
Only run grub-install if we're actually running on an EFI system
Try to avoid errors if people are doing weird things
-rwxr-xr-xdebian/shim-signed.postinst6
-rwxr-xr-xdebian/shim-signed.postrm6
2 files changed, 8 insertions, 4 deletions
diff --git a/debian/shim-signed.postinst b/debian/shim-signed.postinst
index 6163942..d4850e1 100755
--- a/debian/shim-signed.postinst
+++ b/debian/shim-signed.postinst
@@ -51,8 +51,10 @@ case $1 in
# Call grub-install to make sure we're added to the ESP as
# needed
- if [ "$bootloader_id" ] && [ -d "/boot/efi/EFI/$bootloader_id" ] \
- && which grub-install >/dev/null 2>&1
+ if [ "$bootloader_id" ] && \
+ [ -d "/boot/efi/EFI/$bootloader_id" ] && \
+ [ -d /sys/firmware/efi ] && \
+ which grub-install >/dev/null 2>&1
then
# Check for some of the options that matter, so we can
# call grub-install safely without dropping them
diff --git a/debian/shim-signed.postrm b/debian/shim-signed.postrm
index 0db879d..cd62504 100755
--- a/debian/shim-signed.postrm
+++ b/debian/shim-signed.postrm
@@ -54,8 +54,10 @@ case $1 in
# If we're being removed, try to call grub-install to drop us
# from the boot chain in the ESP
- if [ "$bootloader_id" ] && [ -d "/boot/efi/EFI/$bootloader_id" ] \
- && which grub-install >/dev/null 2>&1
+ if [ "$bootloader_id" ] && \
+ [ -d "/boot/efi/EFI/$bootloader_id" ] && \
+ [ -d /sys/firmware/efi ] && \
+ which grub-install >/dev/null 2>&1
then
# Check for some of the options that matter, so we can
# call grub-install without dropping them