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).
main
Kevin Kofler 10 years ago
parent 5209af0182
commit 3d9116b80e

@ -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"

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

Loading…
Cancel
Save