From 4a0a8083f389e0aa8efbfd4b52c5b3ebf6ed3ad0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Nov 2019 16:32:14 +0100 Subject: [PATCH] [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. --- src/modules/grubcfg/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index 866cd4815..79679790c 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -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 = []