From 3d9116b80ec5bba8cee4e92ce9c6d3cf43e75474 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Fri, 5 Dec 2014 01:03:21 +0100 Subject: [PATCH] grub: Add an optional efiBootloaderId setting. If the efiBootloaderId is set, it is used as the --bootloader-id when installing grub-efi. The rationale is pretty much the same as for the Gummiboot case. If the setting is not used, the --bootloader-id is determined from the branding's bootloaderEntryName (as before). --- src/modules/grub/grub.conf | 5 +++++ src/modules/grub/main.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/grub/grub.conf b/src/modules/grub/grub.conf index 0f84abf75..ffef6f62e 100644 --- a/src/modules/grub/grub.conf +++ b/src/modules/grub/grub.conf @@ -4,3 +4,8 @@ grubInstall: "grub-install" grubMkconfig: "grub-mkconfig" grubCfg: "/boot/grub/grub.cfg" +# Optionally set the --bootloader-id to use for EFI. If not set, this defaults +# to the bootloaderEntryName from branding.desc with problematic characters +# replaced. If an efiBootloaderId is specified here, it is taken to already be a +# valid directory name, so no such postprocessing is done in this case. +# efiBootloaderId: "dirname" diff --git a/src/modules/grub/main.py b/src/modules/grub/main.py index 7ee457610..e97e56874 100644 --- a/src/modules/grub/main.py +++ b/src/modules/grub/main.py @@ -26,10 +26,14 @@ from libcalamares.utils import check_chroot_call def install_grub(boot_loader, fw_type): if fw_type == 'efi': efi_directory = "/boot/efi" - branding = libcalamares.globalstorage.value("branding") - distribution = branding["bootloaderEntryName"] - file_name_sanitizer = str.maketrans(" /", "_-") - check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi", "--efi-directory={!s}".format(efi_directory), "--bootloader-id={!s}".format(distribution.translate(file_name_sanitizer))]) + if "efiBootloaderId" in libcalamares.job.configuration: + efi_bootloader_id = libcalamares.job.configuration["efiBootloaderId"] + else: + branding = libcalamares.globalstorage.value("branding") + distribution = branding["bootloaderEntryName"] + file_name_sanitizer = str.maketrans(" /", "_-") + efi_bootloader_id = distribution.translate(file_name_sanitizer) + check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi", "--efi-directory={!s}".format(efi_directory), "--bootloader-id={!s}".format(efi_bootloader_id)]) else: install_path = boot_loader["installPath"] check_chroot_call([libcalamares.job.configuration["grubInstall"], install_path])