From 93f0de3f7f7f2607e243b35e0d8420751934941f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= Date: Thu, 19 Feb 2015 17:39:11 +0100 Subject: [PATCH] [bootloader] make gummiboot entries more generic (use branding) --- src/modules/bootloader/bootloader.conf | 10 +++++----- src/modules/bootloader/main.py | 26 ++++++++++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/modules/bootloader/bootloader.conf b/src/modules/bootloader/bootloader.conf index 633ee6908..fd7bdec08 100644 --- a/src/modules/bootloader/bootloader.conf +++ b/src/modules/bootloader/bootloader.conf @@ -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. diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 33cb25699..d6e781e3c 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -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)