Blame SOURCES/0015-Make-SET_VARIABLE-get-handled-individually-in-GetNex.patch

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