[grubcfg] Only replace a GRUB_DISTRIBUTOR line if wanted
This commit is contained in:
parent
aae7d7dd0a
commit
ac3b50fabb
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user