From 496cefd9ea37bd9109a9372a8ac4296ded2ae0aa Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 17 Jun 2018 18:15:08 +0100 Subject: [PATCH] installer: Create a flag that marks if EFI support is available Signed-off-by: Michael Tremer --- src/installer/hw.c | 8 ++++++-- src/installer/hw.h | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index edf7aeb0b9..0cfeb521fc 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -81,7 +81,10 @@ struct hw* hw_init() { // Detect if we are running in EFI mode ret = access("/sys/firmware/efi", R_OK); if (ret == 0) - hw->efi = 1; + hw->efi_supported = 1; + + // Should we install in EFI mode? + hw->efi = 1; return hw; } @@ -1063,7 +1066,8 @@ int hw_install_bootloader(struct hw* hw, struct hw_destination* dest, const char // Install GRUB in EFI mode if (hw->efi) { snprintf(cmd, sizeof(cmd), "/usr/sbin/grub-install" - " --target=%s-efi --efi-directory=%s", hw->arch, HW_PATH_BOOT_EFI); + " --target=%s-efi --efi-directory=%s %s", hw->arch, HW_PATH_BOOT_EFI, + (hw->efi_supported) ? "" : "--no-nvram"); r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd); if (r) diff --git a/src/installer/hw.h b/src/installer/hw.h index f446d1c433..4e0afc4314 100644 --- a/src/installer/hw.h +++ b/src/installer/hw.h @@ -60,7 +60,12 @@ struct hw { struct udev *udev; char arch[STRING_SIZE]; + + // Enabled if we should install in EFI mode int efi; + + // Enabled if this system supports EFI + int efi_supported; }; struct hw_disk { -- 2.39.5