|
|
24fce8 |
From d3c64808b6fc4794e2c58b1812315914966afea9 Mon Sep 17 00:00:00 2001
|
|
|
24fce8 |
From: Robert Marshall <rmarshall@redhat.com>
|
|
|
24fce8 |
Date: Thu, 22 Dec 2016 17:56:44 -0500
|
|
|
24fce8 |
Subject: [PATCH 38/55] Write correct default to environment (#1285601)
|
|
|
24fce8 |
|
|
|
24fce8 |
grubby writes the title of the default boot entry to the bootloader
|
|
|
24fce8 |
environment. The title lookup did not correctly account for the offset
|
|
|
24fce8 |
required if some boot entries were marked for removal.
|
|
|
24fce8 |
|
|
|
24fce8 |
Related: rhbz#1285601
|
|
|
24fce8 |
---
|
|
|
24fce8 |
grubby.c | 15 ++++++++++++++-
|
|
|
24fce8 |
1 file changed, 14 insertions(+), 1 deletion(-)
|
|
|
24fce8 |
|
|
|
24fce8 |
diff --git a/grubby.c b/grubby.c
|
|
|
24fce8 |
index 692c351ccb6..9edb26d0ded 100644
|
|
|
24fce8 |
--- a/grubby.c
|
|
|
24fce8 |
+++ b/grubby.c
|
|
|
24fce8 |
@@ -1709,7 +1709,20 @@ static void writeDefault(FILE * out, char *indent,
|
|
|
24fce8 |
fprintf(out, "%sset default=\"${saved_entry}\"\n", indent);
|
|
|
24fce8 |
if (cfg->defaultImage >= FIRST_ENTRY_INDEX && cfg->cfi->setEnv) {
|
|
|
24fce8 |
char *title;
|
|
|
24fce8 |
- entry = findEntryByIndex(cfg, cfg->defaultImage);
|
|
|
24fce8 |
+ int trueIndex, currentIndex;
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+ trueIndex = 0;
|
|
|
24fce8 |
+ currentIndex = 0;
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+ while ((entry = findEntryByIndex(cfg, currentIndex))) {
|
|
|
24fce8 |
+ if (!entry->skip) {
|
|
|
24fce8 |
+ if (trueIndex == cfg->defaultImage) {
|
|
|
24fce8 |
+ break;
|
|
|
24fce8 |
+ }
|
|
|
24fce8 |
+ trueIndex++;
|
|
|
24fce8 |
+ }
|
|
|
24fce8 |
+ currentIndex++;
|
|
|
24fce8 |
+ }
|
|
|
24fce8 |
line = getLineByType(LT_MENUENTRY, entry->lines);
|
|
|
24fce8 |
if (!line)
|
|
|
24fce8 |
line = getLineByType(LT_TITLE, entry->lines);
|
|
|
24fce8 |
--
|
|
|
24fce8 |
2.17.1
|
|
|
24fce8 |
|