[bootloader] make gummiboot entries more generic (use branding)

main
Philip Müller 10 years ago
parent df9a2e38a8
commit 93f0de3f7f

@ -5,15 +5,15 @@ efiBootLoader: "grub"
# 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"
kernelLine: "Linux core repo kernel"
fallbackKernelLine: "Linux fallback kernel"
timeout: "10"
# Optionally set the menu entry name and kenrnel namesto use in Gummiboot.
# If not specified here, this setting will be taken from branding.desc.
# productName: "Generic GNU/Linux"
# kernelLine: " with Stable-Kernel"
# fallbackKernelLine: " with Stable-Kernel (fallback initramfs)"
# GRUB 2 binary names and boot directory
# Some distributions (e.g. Fedora) use grub2-* (resp. /boot/grub2/) names.

@ -45,11 +45,24 @@ def get_uuid():
def get_bootloader_entry_name():
if "bootloaderEntryName" in libcalamares.job.configuration:
if "productName" in libcalamares.job.configuration:
return libcalamares.job.configuration["bootloaderEntryName"]
else:
branding = libcalamares.globalstorage.value("branding")
return branding["bootloaderEntryName"]
return branding["productName"]
def get_kernel_line(kernel_type):
if "bootloaderEntryName" in libcalamares.job.configuration:
if kernel_type == "fallback":
return libcalamares.job.configuration["fallbackKernelLine"]
else:
return libcalamares.job.configuration["kernelLine"]
else:
if kernel_type == "fallback":
return " (fallback)"
else:
return ""
def create_conf(uuid, conf_path, kernel_line):
@ -66,7 +79,7 @@ def create_conf(uuid, conf_path, kernel_line):
'## This is just an example config file.\n',
'## Please edit the paths and kernel parameters according to your system.\n',
'\n',
"title {!s} GNU/Linux, with {!s}\n".format(distribution,kernel_line),
"title {!s}{!s}\n".format(distribution,kernel_line),
"linux {!s}\n".format(kernel),
"initrd {!s}\n".format(img),
"options root=UUID={!s} quiet resume=UUID={!s} rw\n".format(uuid, swap),
@ -97,7 +110,6 @@ def create_loader(loader_path):
def install_gummiboot(efi_directory):
install_path = libcalamares.globalstorage.value("rootMountPoint")
install_efi_directory = install_path + efi_directory
kernel_line = libcalamares.job.configuration["kernelLine"]
fallback_kernel_line = libcalamares.job.configuration["fallbackKernelLine"]
uuid = get_uuid()
distribution = get_bootloader_entry_name()
@ -112,10 +124,12 @@ def install_gummiboot(efi_directory):
loader_path = os.path.join(
install_efi_directory, "loader", "loader.conf")
subprocess.call(["gummiboot", "--path={!s}".format(install_efi_directory), "install"])
kernel_line = get_bootloader_entry_name("default")
print("Configure: \"{!s}\"".format(kernel_line))
create_conf(uuid, conf_path, kernel_line)
print("Configure: \"{!s}\"".format(fallback_kernel_line))
create_conf(uuid, fallback_path, fallback_kernel_line)
kernel_line = get_bootloader_entry_name("fallback")
print("Configure: \"{!s}\"".format(kernel_line))
create_conf(uuid, fallback_path, kernel_line)
create_loader(loader_path)

Loading…
Cancel
Save