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).
This commit is contained in:
Kevin Kofler 2014-12-05 01:03:21 +01:00
parent 5209af0182
commit 3d9116b80e
2 changed files with 13 additions and 4 deletions

View file

@ -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])