|
|
24fce8 |
From 5c8744420dfc891b2422db8f0be4bad2368f9970 Mon Sep 17 00:00:00 2001
|
|
|
24fce8 |
From: Peter Jones <pjones@redhat.com>
|
|
|
24fce8 |
Date: Thu, 6 Aug 2015 10:07:11 -0400
|
|
|
24fce8 |
Subject: [PATCH 15/55] Make SET_VARIABLE get handled individually in
|
|
|
24fce8 |
GetNextLine()
|
|
|
24fce8 |
|
|
|
24fce8 |
Resolves: rhbz#1152550
|
|
|
24fce8 |
|
|
|
24fce8 |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
24fce8 |
---
|
|
|
24fce8 |
grubby.c | 119 ++++++++++++++++++++++-----
|
|
|
24fce8 |
.gitignore | 2 +
|
|
|
24fce8 |
test.sh | 8 ++
|
|
|
24fce8 |
test/grub2.16 | 156 +++++++++++++++++++++++++++++++++++
|
|
|
24fce8 |
test/results/add/g2-1.16 | 170 +++++++++++++++++++++++++++++++++++++++
|
|
|
24fce8 |
5 files changed, 433 insertions(+), 22 deletions(-)
|
|
|
24fce8 |
create mode 100644 test/grub2.16
|
|
|
24fce8 |
create mode 100644 test/results/add/g2-1.16
|
|
|
24fce8 |
|
|
|
24fce8 |
diff --git a/grubby.c b/grubby.c
|
|
|
24fce8 |
index fe6595b8386..d66c1c5a40a 100644
|
|
|
24fce8 |
--- a/grubby.c
|
|
|
24fce8 |
+++ b/grubby.c
|
|
|
24fce8 |
@@ -75,6 +75,7 @@ struct lineElement {
|
|
|
24fce8 |
};
|
|
|
24fce8 |
|
|
|
24fce8 |
enum lineType_e {
|
|
|
24fce8 |
+ LT_UNIDENTIFIED = 0,
|
|
|
24fce8 |
LT_WHITESPACE = 1 << 0,
|
|
|
24fce8 |
LT_TITLE = 1 << 1,
|
|
|
24fce8 |
LT_KERNEL = 1 << 2,
|
|
|
24fce8 |
@@ -747,6 +748,33 @@ static char *sdupprintf(const char *format, ...)
|
|
|
24fce8 |
return buf;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
|
|
|
24fce8 |
+static inline int
|
|
|
24fce8 |
+kwcmp(struct keywordTypes *kw, const char * label, int case_insensitive)
|
|
|
24fce8 |
+{
|
|
|
24fce8 |
+ int kwl = strlen(kw->key);
|
|
|
24fce8 |
+ int ll = strlen(label);
|
|
|
24fce8 |
+ int rc;
|
|
|
24fce8 |
+ int (*snc)(const char *s1, const char *s2, size_t n) =
|
|
|
24fce8 |
+ case_insensitive ? strncasecmp : strncmp;
|
|
|
24fce8 |
+ int (*sc)(const char *s1, const char *s2) =
|
|
|
24fce8 |
+ case_insensitive ? strcasecmp : strcmp;
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+ rc = snc(kw->key, label, kwl);
|
|
|
24fce8 |
+ if (rc)
|
|
|
24fce8 |
+ return rc;
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+ for (int i = kwl; i < ll; i++) {
|
|
|
24fce8 |
+ if (isspace(label[i]))
|
|
|
24fce8 |
+ return 0;
|
|
|
24fce8 |
+ if (kw->separatorChar && label[i] == kw->separatorChar)
|
|
|
24fce8 |
+ return 0;
|
|
|
24fce8 |
+ else if (kw->nextChar && label[i] == kw->nextChar)
|
|
|
24fce8 |
+ return 0;
|
|
|
24fce8 |
+ return sc(kw->key+kwl, label+kwl);
|
|
|
24fce8 |
+ }
|
|
|
24fce8 |
+ return 0;
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
static enum lineType_e preferredLineType(enum lineType_e type,
|
|
|
24fce8 |
struct configFileInfo *cfi)
|
|
|
24fce8 |
{
|
|
|
24fce8 |
@@ -812,13 +840,8 @@ static enum lineType_e getTypeByKeyword(char *keyword,
|
|
|
24fce8 |
struct configFileInfo *cfi)
|
|
|
24fce8 |
{
|
|
|
24fce8 |
for (struct keywordTypes * kw = cfi->keywords; kw->key; kw++) {
|
|
|
24fce8 |
- if (cfi->caseInsensitive) {
|
|
|
24fce8 |
- if (!strcasecmp(keyword, kw->key))
|
|
|
24fce8 |
- return kw->type;
|
|
|
24fce8 |
- } else {
|
|
|
24fce8 |
- if (!strcmp(keyword, kw->key))
|
|
|
24fce8 |
- return kw->type;
|
|
|
24fce8 |
- }
|
|
|
24fce8 |
+ if (!kwcmp(kw, keyword, cfi->caseInsensitive))
|
|
|
24fce8 |
+ return kw->type;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
return LT_UNKNOWN;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
@@ -913,6 +936,7 @@ static int readFile(int fd, char **bufPtr)
|
|
|
24fce8 |
|
|
|
24fce8 |
static void lineInit(struct singleLine *line)
|
|
|
24fce8 |
{
|
|
|
24fce8 |
+ line->type = LT_UNIDENTIFIED;
|
|
|
24fce8 |
line->indent = NULL;
|
|
|
24fce8 |
line->elements = NULL;
|
|
|
24fce8 |
line->numElements = 0;
|
|
|
24fce8 |
@@ -995,7 +1019,7 @@ static int lineWrite(FILE * out, struct singleLine *line,
|
|
|
24fce8 |
|
|
|
24fce8 |
if (fprintf(out, "%s", line->elements[i].item) == -1)
|
|
|
24fce8 |
return -1;
|
|
|
24fce8 |
- if (i < line->numElements - 1)
|
|
|
24fce8 |
+ if (i < line->numElements - 1 || line->type == LT_SET_VARIABLE)
|
|
|
24fce8 |
if (fprintf(out, "%s", line->elements[i].indent) == -1)
|
|
|
24fce8 |
return -1;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
@@ -1050,6 +1074,8 @@ static int getNextLine(char **bufPtr, struct singleLine *line,
|
|
|
24fce8 |
break;
|
|
|
24fce8 |
chptr++;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
+ if (line->type == LT_UNIDENTIFIED)
|
|
|
24fce8 |
+ line->type = getTypeByKeyword(start, cfi);
|
|
|
24fce8 |
element->item = strndup(start, chptr - start);
|
|
|
24fce8 |
start = chptr;
|
|
|
24fce8 |
|
|
|
24fce8 |
@@ -1115,7 +1141,7 @@ static int getNextLine(char **bufPtr, struct singleLine *line,
|
|
|
24fce8 |
line->type = LT_WHITESPACE;
|
|
|
24fce8 |
line->numElements = 0;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
- } else {
|
|
|
24fce8 |
+ } else if (line->type == LT_INITRD) {
|
|
|
24fce8 |
struct keywordTypes *kw;
|
|
|
24fce8 |
|
|
|
24fce8 |
kw = getKeywordByType(line->type, cfi);
|
|
|
24fce8 |
@@ -1177,6 +1203,39 @@ static int getNextLine(char **bufPtr, struct singleLine *line,
|
|
|
24fce8 |
}
|
|
|
24fce8 |
}
|
|
|
24fce8 |
}
|
|
|
24fce8 |
+ } else if (line->type == LT_SET_VARIABLE) {
|
|
|
24fce8 |
+ /* and if it's a "set blah=" we need to split it
|
|
|
24fce8 |
+ * yet a third way to avoid rhbz# XXX FIXME :/
|
|
|
24fce8 |
+ */
|
|
|
24fce8 |
+ char *eq;
|
|
|
24fce8 |
+ int l;
|
|
|
24fce8 |
+ int numElements = line->numElements;
|
|
|
24fce8 |
+ struct lineElement *newElements;
|
|
|
24fce8 |
+ eq = strchr(line->elements[1].item, '=');
|
|
|
24fce8 |
+ if (!eq)
|
|
|
24fce8 |
+ return 0;
|
|
|
24fce8 |
+ l = eq - line->elements[1].item;
|
|
|
24fce8 |
+ if (eq[1] != 0)
|
|
|
24fce8 |
+ numElements++;
|
|
|
24fce8 |
+ newElements = calloc(numElements,sizeof (*newElements));
|
|
|
24fce8 |
+ memcpy(&newElements[0], &line->elements[0],
|
|
|
24fce8 |
+ sizeof (newElements[0]));
|
|
|
24fce8 |
+ newElements[1].item =
|
|
|
24fce8 |
+ strndup(line->elements[1].item, l);
|
|
|
24fce8 |
+ newElements[1].indent = "=";
|
|
|
24fce8 |
+ *(eq++) = '\0';
|
|
|
24fce8 |
+ newElements[2].item = strdup(eq);
|
|
|
24fce8 |
+ free(line->elements[1].item);
|
|
|
24fce8 |
+ if (line->elements[1].indent)
|
|
|
24fce8 |
+ newElements[2].indent = line->elements[1].indent;
|
|
|
24fce8 |
+ for (int i = 2; i < line->numElements; i++) {
|
|
|
24fce8 |
+ newElements[i+1].item = line->elements[i].item;
|
|
|
24fce8 |
+ newElements[i+1].indent =
|
|
|
24fce8 |
+ line->elements[i].indent;
|
|
|
24fce8 |
+ }
|
|
|
24fce8 |
+ free(line->elements);
|
|
|
24fce8 |
+ line->elements = newElements;
|
|
|
24fce8 |
+ line->numElements = numElements;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
}
|
|
|
24fce8 |
|
|
|
24fce8 |
@@ -1282,13 +1341,12 @@ static struct grubConfig *readConfig(const char *inName,
|
|
|
24fce8 |
getKeywordByType(LT_DEFAULT, cfi);
|
|
|
24fce8 |
if (kwType && line->numElements == 3
|
|
|
24fce8 |
&& !strcmp(line->elements[1].item, kwType->key)
|
|
|
24fce8 |
- && !is_special_grub2_variable(line->elements[2].
|
|
|
24fce8 |
- item)) {
|
|
|
24fce8 |
+ && !is_special_grub2_variable(
|
|
|
24fce8 |
+ line->elements[2].item)) {
|
|
|
24fce8 |
dbgPrintf("Line sets default config\n");
|
|
|
24fce8 |
cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT;
|
|
|
24fce8 |
defaultLine = line;
|
|
|
24fce8 |
}
|
|
|
24fce8 |
-
|
|
|
24fce8 |
} else if (iskernel(line->type)) {
|
|
|
24fce8 |
/* if by some freak chance this is multiboot and the
|
|
|
24fce8 |
* "module" lines came earlier in the template, make
|
|
|
24fce8 |
@@ -1542,16 +1600,33 @@ static struct grubConfig *readConfig(const char *inName,
|
|
|
24fce8 |
}
|
|
|
24fce8 |
}
|
|
|
24fce8 |
} else if (cfi->defaultIsVariable) {
|
|
|
24fce8 |
- char *value = defaultLine->elements[2].item;
|
|
|
24fce8 |
- while (*value && (*value == '"' || *value == '\'' ||
|
|
|
24fce8 |
- *value == ' ' || *value == '\t'))
|
|
|
24fce8 |
- value++;
|
|
|
24fce8 |
- cfg->defaultImage = strtol(value, &end, 10);
|
|
|
24fce8 |
- while (*end && (*end == '"' || *end == '\'' ||
|
|
|
24fce8 |
- *end == ' ' || *end == '\t'))
|
|
|
24fce8 |
- end++;
|
|
|
24fce8 |
- if (*end)
|
|
|
24fce8 |
- cfg->defaultImage = -1;
|
|
|
24fce8 |
+ if (defaultLine->numElements == 2) {
|
|
|
24fce8 |
+ char *value = defaultLine->elements[1].item + 8;
|
|
|
24fce8 |
+ while (*value && (*value == '"' ||
|
|
|
24fce8 |
+ *value == '\'' ||
|
|
|
24fce8 |
+ *value == ' ' ||
|
|
|
24fce8 |
+ *value == '\t'))
|
|
|
24fce8 |
+ value++;
|
|
|
24fce8 |
+ cfg->defaultImage = strtol(value, &end, 10);
|
|
|
24fce8 |
+ while (*end && (*end == '"' || *end == '\'' ||
|
|
|
24fce8 |
+ *end == ' ' || *end == '\t'))
|
|
|
24fce8 |
+ end++;
|
|
|
24fce8 |
+ if (*end)
|
|
|
24fce8 |
+ cfg->defaultImage = -1;
|
|
|
24fce8 |
+ } else if (defaultLine->numElements == 3) {
|
|
|
24fce8 |
+ char *value = defaultLine->elements[2].item;
|
|
|
24fce8 |
+ while (*value && (*value == '"' ||
|
|
|
24fce8 |
+ *value == '\'' ||
|
|
|
24fce8 |
+ *value == ' ' ||
|
|
|
24fce8 |
+ *value == '\t'))
|
|
|
24fce8 |
+ value++;
|
|
|
24fce8 |
+ cfg->defaultImage = strtol(value, &end, 10);
|
|
|
24fce8 |
+ while (*end && (*end == '"' || *end == '\'' ||
|
|
|
24fce8 |
+ *end == ' ' || *end == '\t'))
|
|
|
24fce8 |
+ end++;
|
|
|
24fce8 |
+ if (*end)
|
|
|
24fce8 |
+ cfg->defaultImage = -1;
|
|
|
24fce8 |
+ }
|
|
|
24fce8 |
} else if (cfi->defaultSupportSaved &&
|
|
|
24fce8 |
!strncmp(defaultLine->elements[1].item, "saved",
|
|
|
24fce8 |
5)) {
|
|
|
24fce8 |
diff --git a/.gitignore b/.gitignore
|
|
|
24fce8 |
index e64d3bc0986..e78a392d601 100644
|
|
|
24fce8 |
--- a/.gitignore
|
|
|
24fce8 |
+++ b/.gitignore
|
|
|
24fce8 |
@@ -1,3 +1,5 @@
|
|
|
24fce8 |
grubby
|
|
|
24fce8 |
version.h
|
|
|
24fce8 |
*.o
|
|
|
24fce8 |
+core.*
|
|
|
24fce8 |
+vgcore.*
|
|
|
24fce8 |
diff --git a/test.sh b/test.sh
|
|
|
24fce8 |
index 2985fd62bf9..cd2d8707b5f 100755
|
|
|
24fce8 |
--- a/test.sh
|
|
|
24fce8 |
+++ b/test.sh
|
|
|
24fce8 |
@@ -543,6 +543,14 @@ if [ "$testgrub2" == "y" ]; then
|
|
|
24fce8 |
--copy-default --title "Fedora 21 Rescue" --args=root=/fooooo \
|
|
|
24fce8 |
--remove-kernel=wtf --boot-filesystem=/boot/ --efi
|
|
|
24fce8 |
|
|
|
24fce8 |
+ # a grub2 add with a "set" of the form: set foo="bar=1,2". bz#1152550
|
|
|
24fce8 |
+ # has this being emitted as: set foo="bar=1,2"=1,2"
|
|
|
24fce8 |
+ # which is wrong.
|
|
|
24fce8 |
+ grub2Test grub2.16 add/g2-1.16 \
|
|
|
24fce8 |
+ --add-kernel=/boot/vmlinuz-foo \
|
|
|
24fce8 |
+ --copy-default --title 'Red Hat Enterprise Linux Server' \
|
|
|
24fce8 |
+ --args=root=/dev/mapper/foo--
|
|
|
24fce8 |
+
|
|
|
24fce8 |
testing="GRUB2 add initrd"
|
|
|
24fce8 |
grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
|
|
|
24fce8 |
--initrd=/boot/new-initrd --boot-filesystem=/boot/
|
|
|
24fce8 |
diff --git a/test/grub2.16 b/test/grub2.16
|
|
|
24fce8 |
new file mode 100644
|
|
|
24fce8 |
index 00000000000..136880a61ee
|
|
|
24fce8 |
--- /dev/null
|
|
|
24fce8 |
+++ b/test/grub2.16
|
|
|
24fce8 |
@@ -0,0 +1,156 @@
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# DO NOT EDIT THIS FILE
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
24fce8 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
24fce8 |
+set pager=1
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ -s $prefix/grubenv ]; then
|
|
|
24fce8 |
+ load_env
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+if [ "${next_entry}" ] ; then
|
|
|
24fce8 |
+ set default="${next_entry}"
|
|
|
24fce8 |
+ set next_entry=
|
|
|
24fce8 |
+ save_env next_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ set default="${saved_entry}"
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ x"${feature_menuentry_id}" = xy ]; then
|
|
|
24fce8 |
+ menuentry_id_option="--id"
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ menuentry_id_option=""
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+export menuentry_id_option
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
24fce8 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ set prev_saved_entry=
|
|
|
24fce8 |
+ save_env prev_saved_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function savedefault {
|
|
|
24fce8 |
+ if [ -z "${boot_once}" ]; then
|
|
|
24fce8 |
+ saved_entry="${chosen}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function load_video {
|
|
|
24fce8 |
+ if [ x$feature_all_video_module = xy ]; then
|
|
|
24fce8 |
+ insmod all_video
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ insmod efi_gop
|
|
|
24fce8 |
+ insmod efi_uga
|
|
|
24fce8 |
+ insmod ieee1275_fb
|
|
|
24fce8 |
+ insmod vbe
|
|
|
24fce8 |
+ insmod vga
|
|
|
24fce8 |
+ insmod video_bochs
|
|
|
24fce8 |
+ insmod video_cirrus
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+serial --speed=115200
|
|
|
24fce8 |
+terminal_input serial console
|
|
|
24fce8 |
+terminal_output serial console
|
|
|
24fce8 |
+if [ x$feature_timeout_style = xy ] ; then
|
|
|
24fce8 |
+ set timeout_style=menu
|
|
|
24fce8 |
+ set timeout=5
|
|
|
24fce8 |
+# Fallback normal timeout code in case the timeout_style feature is
|
|
|
24fce8 |
+# unavailable.
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ set timeout=5
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/00_header ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/00_tuned ###
|
|
|
24fce8 |
+set tuned_params="isolcpus=1,3"
|
|
|
24fce8 |
+### END /etc/grub.d/00_tuned ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/01_users ###
|
|
|
24fce8 |
+if [ -f ${prefix}/user.cfg ]; then
|
|
|
24fce8 |
+ source ${prefix}/user.cfg
|
|
|
24fce8 |
+ if [ -n ${GRUB2_PASSWORD} ]; then
|
|
|
24fce8 |
+ set superusers="root"
|
|
|
24fce8 |
+ export superusers
|
|
|
24fce8 |
+ password_pbkdf2 root ${GRUB2_PASSWORD}
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/01_users ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-297.el7.x86_64) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-296.el7.x86_64-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-3.10.0-297.el7.x86_64 root=/dev/mapper/rhel_hp--dl380pgen8--02--vm--10-root ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params LANG=en_US.UTF-8
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-296.el7.x86_64) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-296.el7.x86_64-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-3.10.0-296.el7.x86_64 root=/dev/mapper/rhel_hp--dl380pgen8--02--vm--10-root ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params
|
|
|
24fce8 |
+ initrd16 /initramfs-3.10.0-296.el7.x86_64.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server (0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7 root=/dev/mapper/rhel_hp--dl380pgen8--02--vm--10-root ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params
|
|
|
24fce8 |
+ initrd16 /initramfs-0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+if [ "x$default" = 'Red Hat Enterprise Linux Server (3.10.0-296.el7.x86_64) 7.2 (Maipo)' ]; then default='Advanced options for Red Hat Enterprise Linux Server>Red Hat Enterprise Linux Server (3.10.0-296.el7.x86_64) 7.2 (Maipo)'; fi;
|
|
|
24fce8 |
+### END /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
|
|
|
24fce8 |
+### END /etc/grub.d/20_ppc_terminfo ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
24fce8 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
24fce8 |
+# the 'exec tail' line above.
|
|
|
24fce8 |
+### END /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
24fce8 |
+if [ -f ${config_directory}/custom.cfg ]; then
|
|
|
24fce8 |
+ source ${config_directory}/custom.cfg
|
|
|
24fce8 |
+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
|
|
|
24fce8 |
+ source $prefix/custom.cfg;
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/41_custom ###
|
|
|
24fce8 |
diff --git a/test/results/add/g2-1.16 b/test/results/add/g2-1.16
|
|
|
24fce8 |
new file mode 100644
|
|
|
24fce8 |
index 00000000000..fc98757f4fc
|
|
|
24fce8 |
--- /dev/null
|
|
|
24fce8 |
+++ b/test/results/add/g2-1.16
|
|
|
24fce8 |
@@ -0,0 +1,170 @@
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# DO NOT EDIT THIS FILE
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
24fce8 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
24fce8 |
+set pager=1
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ -s $prefix/grubenv ]; then
|
|
|
24fce8 |
+ load_env
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+if [ "${next_entry}" ] ; then
|
|
|
24fce8 |
+ set default="${next_entry}"
|
|
|
24fce8 |
+ set next_entry=
|
|
|
24fce8 |
+ save_env next_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ set default="${saved_entry}"
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ x"${feature_menuentry_id}" = xy ]; then
|
|
|
24fce8 |
+ menuentry_id_option="--id"
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ menuentry_id_option=""
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+export menuentry_id_option
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
24fce8 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ set prev_saved_entry=
|
|
|
24fce8 |
+ save_env prev_saved_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function savedefault {
|
|
|
24fce8 |
+ if [ -z "${boot_once}" ]; then
|
|
|
24fce8 |
+ saved_entry="${chosen}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function load_video {
|
|
|
24fce8 |
+ if [ x$feature_all_video_module = xy ]; then
|
|
|
24fce8 |
+ insmod all_video
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ insmod efi_gop
|
|
|
24fce8 |
+ insmod efi_uga
|
|
|
24fce8 |
+ insmod ieee1275_fb
|
|
|
24fce8 |
+ insmod vbe
|
|
|
24fce8 |
+ insmod vga
|
|
|
24fce8 |
+ insmod video_bochs
|
|
|
24fce8 |
+ insmod video_cirrus
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+serial --speed=115200
|
|
|
24fce8 |
+terminal_input serial console
|
|
|
24fce8 |
+terminal_output serial console
|
|
|
24fce8 |
+if [ x$feature_timeout_style = xy ] ; then
|
|
|
24fce8 |
+ set timeout_style=menu
|
|
|
24fce8 |
+ set timeout=5
|
|
|
24fce8 |
+# Fallback normal timeout code in case the timeout_style feature is
|
|
|
24fce8 |
+# unavailable.
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ set timeout=5
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/00_header ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/00_tuned ###
|
|
|
24fce8 |
+set tuned_params="isolcpus=1,3"
|
|
|
24fce8 |
+### END /etc/grub.d/00_tuned ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/01_users ###
|
|
|
24fce8 |
+if [ -f ${prefix}/user.cfg ]; then
|
|
|
24fce8 |
+ source ${prefix}/user.cfg
|
|
|
24fce8 |
+ if [ -n ${GRUB2_PASSWORD} ]; then
|
|
|
24fce8 |
+ set superusers="root"
|
|
|
24fce8 |
+ export superusers
|
|
|
24fce8 |
+ password_pbkdf2 root ${GRUB2_PASSWORD}
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/01_users ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-296.el7.x86_64-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-foo root=/dev/mapper/foo-- ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params LANG=en_US.UTF-8
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-297.el7.x86_64) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-296.el7.x86_64-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-3.10.0-297.el7.x86_64 root=/dev/mapper/rhel_hp--dl380pgen8--02--vm--10-root ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params LANG=en_US.UTF-8
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-296.el7.x86_64) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-296.el7.x86_64-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-3.10.0-296.el7.x86_64 root=/dev/mapper/rhel_hp--dl380pgen8--02--vm--10-root ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params
|
|
|
24fce8 |
+ initrd16 /initramfs-3.10.0-296.el7.x86_64.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Red Hat Enterprise Linux Server (0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7-advanced-ae7b3742-9092-4432-9f7f-8abdbf0dc3db' {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ insmod gzio
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod xfs
|
|
|
24fce8 |
+ set root='hd0,msdos1'
|
|
|
24fce8 |
+ if [ x$feature_platform_search_hint = xy ]; then
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ else
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root cae02b39-f239-4d26-9032-674d261c93d8
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+ linux16 /vmlinuz-0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7 root=/dev/mapper/rhel_hp--dl380pgen8--02--vm--10-root ro crashkernel=auto rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/root rd.lvm.lv=rhel_hp-dl380pgen8-02-vm-10/swap console=ttyS0,115200n81 $tuned_params
|
|
|
24fce8 |
+ initrd16 /initramfs-0-rescue-cc21b92886f9ebbd3ed5a494639b7fd7.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+if [ "x$default" = 'Red Hat Enterprise Linux Server (3.10.0-296.el7.x86_64) 7.2 (Maipo)' ]; then default='Advanced options for Red Hat Enterprise Linux Server>Red Hat Enterprise Linux Server (3.10.0-296.el7.x86_64) 7.2 (Maipo)'; fi;
|
|
|
24fce8 |
+### END /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
|
|
|
24fce8 |
+### END /etc/grub.d/20_ppc_terminfo ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
24fce8 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
24fce8 |
+# the 'exec tail' line above.
|
|
|
24fce8 |
+### END /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
24fce8 |
+if [ -f ${config_directory}/custom.cfg ]; then
|
|
|
24fce8 |
+ source ${config_directory}/custom.cfg
|
|
|
24fce8 |
+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
|
|
|
24fce8 |
+ source $prefix/custom.cfg;
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/41_custom ###
|
|
|
24fce8 |
--
|
|
|
24fce8 |
2.17.1
|
|
|
24fce8 |
|