From ac3b50fabba63ca9c29d645aba88790798f66b94 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Nov 2019 16:02:36 +0100 Subject: [PATCH] [grubcfg] Only replace a GRUB_DISTRIBUTOR line if wanted --- src/modules/grubcfg/main.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index 83441a736..d09f15fed 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -45,7 +45,10 @@ def modify_grub_default(partitions, root_mount_point, distributor): :param partitions: :param root_mount_point: - :param distributor: + :param distributor: name of the distributor to fill in for + GRUB_DISTRIBUTOR. Must be a string, but if it is empty ("") + then the existing GRUB_DISTRIBUTOR lines are kept instead + of replaced by a new line. :return: """ default_dir = os.path.join(root_mount_point, "etc/default") @@ -172,7 +175,8 @@ def modify_grub_default(partitions, root_mount_point, distributor): have_kernel_cmd = True elif (lines[i].startswith("#GRUB_DISTRIBUTOR") or lines[i].startswith("GRUB_DISTRIBUTOR")): - lines[i] = distributor_line + if distributor: + lines[i] = distributor_line have_distributor_line = True else: lines = [] @@ -236,6 +240,10 @@ def run(): root_mount_point = libcalamares.globalstorage.value("rootMountPoint") branding = libcalamares.globalstorage.value("branding") - distributor = branding["bootloaderEntryName"] + + if libcalamares.job.configuration.get("keepDistributor", false): + distributor = "" + else: + distributor = branding["bootloaderEntryName"] return modify_grub_default(partitions, root_mount_point, distributor)