mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[grubcfg] Update GRUB_DISTRIBUTION as needed
- Previous fix would erase the distribution information (using an empty string to flag 'preserve existing GRUB_DISTRIBUTION lines'), but that is fragile. A distro might set that, and yet **not** set a GRUB_DISTRIBUTION line, in which case it would end up with a setup without any GRUB_DISTRIBUTION set. - When a GRUB_DISTRIBUTION line is found, **then** check if it should update the line or not. This way, we have a suitable distribution to write if no GRUB_DISTRIBUTION is found at all.
This commit is contained in:
parent
ac3b50fabb
commit
c6c861654d
1 changed files with 8 additions and 9 deletions
|
@ -46,9 +46,12 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||
:param partitions:
|
||||
:param root_mount_point:
|
||||
: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.
|
||||
GRUB_DISTRIBUTOR. Must be a string. If the job setting
|
||||
*keepDistributor* is set, then this is only used if no
|
||||
GRUB_DISTRIBUTOR is found at all (otherwise, when *keepDistributor*
|
||||
is set, the GRUB_DISTRIBUTOR lines are left unchanged).
|
||||
If *keepDistributor* is unset or false, then GRUB_DISTRIBUTOR
|
||||
is always updated to set this value.
|
||||
:return:
|
||||
"""
|
||||
default_dir = os.path.join(root_mount_point, "etc/default")
|
||||
|
@ -175,7 +178,7 @@ 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")):
|
||||
if distributor:
|
||||
if libcalamares.job.configuration.get("keepDistributor", false):
|
||||
lines[i] = distributor_line
|
||||
have_distributor_line = True
|
||||
else:
|
||||
|
@ -240,10 +243,6 @@ def run():
|
|||
|
||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||
branding = libcalamares.globalstorage.value("branding")
|
||||
|
||||
if libcalamares.job.configuration.get("keepDistributor", false):
|
||||
distributor = ""
|
||||
else:
|
||||
distributor = branding["bootloaderEntryName"]
|
||||
distributor = branding["bootloaderEntryName"]
|
||||
|
||||
return modify_grub_default(partitions, root_mount_point, distributor)
|
||||
|
|
Loading…
Add table
Reference in a new issue