[grubcfg] Guard against stupid configurations
- Scenario: *keepDistribution* is true, and the existing file contains a GRUB_DISTRIBUTION line **followed** by a commented-out GRUB_DISTRIBUTION line. - In that case, the commented-out line would change the flag back to False, and we'd end up writing a second GRUB_DISTRIBUTION line at the end. Prevent that: the flag can only go to "True" and then stays there. Editorial: If your grub configuration would have tripped this up, then you're doing something wrong. Clean up the configuration file first.
This commit is contained in:
parent
4a0a8083f3
commit
f727362a90
@ -184,7 +184,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
||||
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("#")
|
||||
have_distributor_line = have_distributor_line or not lines[i].startsdwith("#")
|
||||
else:
|
||||
lines = []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user