bootloader: Allow overriding the bootloaderEntryName setting.

Allow setting bootloaderEntryName in bootloader.conf. If not specified
there, the setting will be taken from branding.desc.
This commit is contained in:
Kevin Kofler 2014-11-19 17:01:02 +01:00
parent 462819060b
commit ab4d31f1a6
2 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,9 @@
---
# Gummiboot configuration files settings, set kernel and initramfs file names
# and amount of time before default selection boots
# Optionally set the menu entry name to use in Gummiboot. If not specified here,
# this setting will be taken from branding.desc.
# bootloaderEntryName: KaOS-kf5
kernel: /vmlinuz-linux
img: /initramfs-linux.img
fallback: /initramfs-linux-fallback.img

View File

@ -52,9 +52,15 @@ def get_uuid():
return ""
def get_bootloader_entry_name():
if "bootloaderEntryName" in libcalamares.job.configuration:
return libcalamares.job.configuration["bootloaderEntryName"]
else:
branding = libcalamares.globalstorage.value("branding")
return branding["bootloaderEntryName"]
def create_conf(uuid, conf_path):
branding = libcalamares.globalstorage.value("branding")
distribution = branding["bootloaderEntryName"]
distribution = get_bootloader_entry_name()
kernel = libcalamares.job.configuration["kernel"]
img = libcalamares.job.configuration["img"]
partitions = libcalamares.globalstorage.value("partitions")
@ -80,8 +86,7 @@ def create_conf(uuid, conf_path):
def create_fallback(uuid, fallback_path):
branding = libcalamares.globalstorage.value("branding")
distribution = branding["bootloaderEntryName"]
distribution = get_bootloader_entry_name()
kernel = libcalamares.job.configuration["kernel"]
fb_img = libcalamares.job.configuration["fallback"]
partitions = libcalamares.globalstorage.value("partitions")
@ -107,8 +112,7 @@ def create_fallback(uuid, fallback_path):
def create_loader(loader_path):
branding = libcalamares.globalstorage.value("branding")
distribution = branding["bootloaderEntryName"]
distribution = get_bootloader_entry_name()
timeout = libcalamares.job.configuration["timeout"]
file_name_sanitizer = str.maketrans(" /", "_-")
lines = [
@ -126,8 +130,7 @@ def install_bootloader(boot_loader, fw_type):
if fw_type == 'efi':
install_path = libcalamares.globalstorage.value("rootMountPoint")
uuid = get_uuid()
branding = libcalamares.globalstorage.value("branding")
distribution = branding["bootloaderEntryName"]
distribution = get_bootloader_entry_name()
file_name_sanitizer = str.maketrans(" /", "_-")
conf_path = os.path.join(
install_path, "boot", "loader", "entries", "%s.conf" % distribution.translate(file_name_sanitizer))