[grubcfg] If we only see #GRUB_DISTRIBUTION, it's not been set

- If we update the line, then GRUB_DISTRIBUTION has been set
 - If we don't update the line (e.g. because of *keepDistribution*)
   then a comment doesn't count as "have seen that line".

This means that if we get to the end of the file, with only commented-
out GRUB_DISTRIBUTION lines, and *keepDistribution* is set, then we'll
still write a distribution line -- because otherwise it's not set at all.
main
Adriaan de Groot 5 years ago
parent c6c861654d
commit 4a0a8083f3

@ -180,7 +180,11 @@ def modify_grub_default(partitions, root_mount_point, distributor):
or lines[i].startswith("GRUB_DISTRIBUTOR")):
if libcalamares.job.configuration.get("keepDistributor", false):
lines[i] = distributor_line
have_distributor_line = True
have_distributor_line = True
else:
# We're not updating because of *keepDistributor*, but if
# this was a comment line, then it's still not been set.
have_distributor_line = not lines[i].startsdwith("#")
else:
lines = []

Loading…
Cancel
Save