grubby/0001-extlinux-Understand-default-properly.patch
Lubomir Rintel dc1eb4a29a Fix extlinux default support
*proven packager hat on*
Package maintainer unresponsive. All patches submitted upstream, no response
either.
2014-01-20 12:37:56 +01:00

82 lines
2.8 KiB
Diff

From 392ee59b91c19c05fc91c9ed92b910d2cf1ed0a8 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Wed, 27 Nov 2013 16:59:50 +0100
Subject: [PATCH 1/4] extlinux: Understand "default" properly
The configuration looks like the following:
default Fedora (3.11.6-301.fc20.i686+PAE) 20 (Heisenbug)
title Fedora (3.11.6-301.fc20.i686+PAE) 20 (Heisenbug)
...
Grubby skips over the default clause as it has more than one element. And even
if it did not, it would not match it against the title, since it handles titles
specially, concatenating the title, but not the default clause.
This commit adds special handling for extlinux, which causes it to parse
default and title in the same way.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
grubby.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/grubby.c b/grubby.c
index 3de53b3..7010526 100644
--- a/grubby.c
+++ b/grubby.c
@@ -151,6 +151,7 @@ struct configFileInfo {
int defaultIsVariable;
int defaultSupportSaved;
int defaultIsSaved;
+ int defaultIsUnquoted;
enum lineType_e entryStart;
enum lineType_e entryEnd;
int needsBootPrefix;
@@ -622,6 +623,7 @@ struct configFileInfo extlinuxConfigType = {
.needsBootPrefix = 1,
.maxTitleLength = 255,
.mbAllowExtraInitRds = 1,
+ .defaultIsUnquoted = 1,
};
struct grubConfig {
@@ -1166,9 +1168,6 @@ static struct grubConfig * readConfig(const char * inName,
cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
defaultLine = line;
}
- } else if (line->type == LT_DEFAULT && line->numElements == 2) {
- cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
- defaultLine = line;
} else if (iskernel(line->type)) {
/* if by some freak chance this is multiboot and the "module"
@@ -1201,8 +1200,9 @@ static struct grubConfig * readConfig(const char * inName,
cfg->fallbackImage = strtol(line->elements[1].item, &end, 10);
if (*end) cfg->fallbackImage = -1;
- } else if (line->type == LT_TITLE && line->numElements > 1) {
- /* make the title a single argument (undoing our parsing) */
+ } else if ((line->type == LT_DEFAULT && cfi->defaultIsUnquoted) ||
+ (line->type == LT_TITLE && line->numElements > 1)) {
+ /* make the title/default a single argument (undoing our parsing) */
len = 0;
for (int i = 1; i < line->numElements; i++) {
len += strlen(line->elements[i].item);
@@ -1309,6 +1309,11 @@ static struct grubConfig * readConfig(const char * inName,
}
}
+ if (line->type == LT_DEFAULT && line->numElements == 2) {
+ cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
+ defaultLine = line;
+ }
+
/* If we find a generic config option which should live at the
top of the file, move it there. Old versions of grubby were
probably responsible for putting new images in the wrong
--
1.8.3.1