|
|
16aa69 |
From 5a5b33da8239428245f3595848f10c0f184041b3 Mon Sep 17 00:00:00 2001
|
|
|
16aa69 |
From: Peter Jones <pjones@redhat.com>
|
|
|
16aa69 |
Date: Mon, 18 Nov 2013 14:44:13 -0500
|
|
|
16aa69 |
Subject: [PATCH 04/41] Honor "linux16" and "initrd16"
|
|
|
16aa69 |
|
|
|
16aa69 |
Resolves: rhbz#1031192
|
|
|
16aa69 |
Resolves: rhbz#1034743
|
|
|
16aa69 |
|
|
|
16aa69 |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
16aa69 |
---
|
|
|
16aa69 |
grubby.c | 63 ++++++++++++++++++++++---------
|
|
|
16aa69 |
test.sh | 16 ++++++++
|
|
|
16aa69 |
test/grub2.10 | 84 +++++++++++++++++++++++++++++++++++++++++
|
|
|
16aa69 |
test/grub2.11 | 97 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
16aa69 |
test/results/add/g2-1.10 | 96 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
16aa69 |
test/results/add/g2-1.11 | 98 ++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
16aa69 |
6 files changed, 437 insertions(+), 17 deletions(-)
|
|
|
16aa69 |
create mode 100644 test/grub2.10
|
|
|
16aa69 |
create mode 100644 test/grub2.11
|
|
|
16aa69 |
create mode 100644 test/results/add/g2-1.10
|
|
|
16aa69 |
create mode 100644 test/results/add/g2-1.11
|
|
|
16aa69 |
|
|
|
16aa69 |
diff --git a/grubby.c b/grubby.c
|
|
|
16aa69 |
index d91a847..aa228c3 100644
|
|
|
16aa69 |
--- a/grubby.c
|
|
|
16aa69 |
+++ b/grubby.c
|
|
|
16aa69 |
@@ -90,7 +90,9 @@ enum lineType_e {
|
|
|
16aa69 |
LT_SET_VARIABLE = 1 << 19,
|
|
|
16aa69 |
LT_KERNEL_EFI = 1 << 20,
|
|
|
16aa69 |
LT_INITRD_EFI = 1 << 21,
|
|
|
16aa69 |
- LT_UNKNOWN = 1 << 22,
|
|
|
16aa69 |
+ LT_KERNEL_16 = 1 << 22,
|
|
|
16aa69 |
+ LT_INITRD_16 = 1 << 23,
|
|
|
16aa69 |
+ LT_UNKNOWN = 1 << 24,
|
|
|
16aa69 |
};
|
|
|
16aa69 |
|
|
|
16aa69 |
struct singleLine {
|
|
|
16aa69 |
@@ -220,8 +222,10 @@ struct keywordTypes grub2Keywords[] = {
|
|
|
16aa69 |
{ "fallback", LT_FALLBACK, ' ' },
|
|
|
16aa69 |
{ "linux", LT_KERNEL, ' ' },
|
|
|
16aa69 |
{ "linuxefi", LT_KERNEL_EFI, ' ' },
|
|
|
16aa69 |
+ { "linux16", LT_KERNEL_16, ' ' },
|
|
|
16aa69 |
{ "initrd", LT_INITRD, ' ', ' ' },
|
|
|
16aa69 |
{ "initrdefi", LT_INITRD_EFI, ' ', ' ' },
|
|
|
16aa69 |
+ { "initrd16", LT_INITRD_16, ' ', ' ' },
|
|
|
16aa69 |
{ "module", LT_MBMODULE, ' ' },
|
|
|
16aa69 |
{ "kernel", LT_HYPER, ' ' },
|
|
|
16aa69 |
{ NULL, 0, 0 },
|
|
|
16aa69 |
@@ -395,11 +399,11 @@ static int isquote(char q)
|
|
|
16aa69 |
}
|
|
|
16aa69 |
|
|
|
16aa69 |
static int iskernel(enum lineType_e type) {
|
|
|
16aa69 |
- return (type == LT_KERNEL || type == LT_KERNEL_EFI);
|
|
|
16aa69 |
+ return (type == LT_KERNEL || type == LT_KERNEL_EFI || type == LT_KERNEL_16);
|
|
|
16aa69 |
}
|
|
|
16aa69 |
|
|
|
16aa69 |
static int isinitrd(enum lineType_e type) {
|
|
|
16aa69 |
- return (type == LT_INITRD || type == LT_INITRD_EFI);
|
|
|
16aa69 |
+ return (type == LT_INITRD || type == LT_INITRD_EFI || type == LT_INITRD_16);
|
|
|
16aa69 |
}
|
|
|
16aa69 |
|
|
|
16aa69 |
char *grub2ExtractTitle(struct singleLine * line) {
|
|
|
16aa69 |
@@ -717,6 +721,17 @@ static enum lineType_e preferredLineType(enum lineType_e type,
|
|
|
16aa69 |
default:
|
|
|
16aa69 |
return type;
|
|
|
16aa69 |
}
|
|
|
16aa69 |
+#if defined(__i386__) || defined(__x86_64__)
|
|
|
16aa69 |
+ } else if (cfi == &grub2ConfigType) {
|
|
|
16aa69 |
+ switch (type) {
|
|
|
16aa69 |
+ case LT_KERNEL:
|
|
|
16aa69 |
+ return LT_KERNEL_16;
|
|
|
16aa69 |
+ case LT_INITRD:
|
|
|
16aa69 |
+ return LT_INITRD_16;
|
|
|
16aa69 |
+ default:
|
|
|
16aa69 |
+ return type;
|
|
|
16aa69 |
+ }
|
|
|
16aa69 |
+#endif
|
|
|
16aa69 |
}
|
|
|
16aa69 |
return type;
|
|
|
16aa69 |
}
|
|
|
16aa69 |
@@ -1804,7 +1819,7 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix,
|
|
|
16aa69 |
return 0;
|
|
|
16aa69 |
}
|
|
|
16aa69 |
|
|
|
16aa69 |
- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
|
|
16aa69 |
if (!line) {
|
|
|
16aa69 |
notSuitablePrintf(entry, 0, "no line found\n");
|
|
|
16aa69 |
return 0;
|
|
|
16aa69 |
@@ -1938,7 +1953,7 @@ struct singleEntry * findEntryByPath(struct grubConfig * config,
|
|
|
16aa69 |
entry = findEntryByIndex(config, indexVars[i]);
|
|
|
16aa69 |
if (!entry) return NULL;
|
|
|
16aa69 |
|
|
|
16aa69 |
- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
|
|
16aa69 |
if (!line) return NULL;
|
|
|
16aa69 |
|
|
|
16aa69 |
if (index) *index = indexVars[i];
|
|
|
16aa69 |
@@ -1989,9 +2004,9 @@ struct singleEntry * findEntryByPath(struct grubConfig * config,
|
|
|
16aa69 |
for (line = entry->lines; line; line = line->next) {
|
|
|
16aa69 |
enum lineType_e ct = checkType;
|
|
|
16aa69 |
if (entry->multiboot && checkType == LT_KERNEL)
|
|
|
16aa69 |
- ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER;
|
|
|
16aa69 |
+ ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER|LT_KERNEL_16;
|
|
|
16aa69 |
else if (checkType & LT_KERNEL)
|
|
|
16aa69 |
- ct = checkType | LT_KERNEL_EFI;
|
|
|
16aa69 |
+ ct = checkType | LT_KERNEL_EFI | LT_KERNEL_16;
|
|
|
16aa69 |
line = getLineByType(ct, line);
|
|
|
16aa69 |
if (!line)
|
|
|
16aa69 |
break; /* not found in this entry */
|
|
|
16aa69 |
@@ -2013,7 +2028,7 @@ struct singleEntry * findEntryByPath(struct grubConfig * config,
|
|
|
16aa69 |
* non-Linux boot entries (could find netbsd etc, though, which is
|
|
|
16aa69 |
* unfortunate)
|
|
|
16aa69 |
*/
|
|
|
16aa69 |
- if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines))
|
|
|
16aa69 |
+ if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines))
|
|
|
16aa69 |
break; /* found 'im! */
|
|
|
16aa69 |
}
|
|
|
16aa69 |
|
|
|
16aa69 |
@@ -2247,7 +2262,7 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
|
|
|
16aa69 |
|
|
|
16aa69 |
printf("index=%d\n", index);
|
|
|
16aa69 |
|
|
|
16aa69 |
- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
|
|
16aa69 |
if (!line) {
|
|
|
16aa69 |
printf("non linux entry\n");
|
|
|
16aa69 |
return;
|
|
|
16aa69 |
@@ -2312,7 +2327,7 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
|
|
|
16aa69 |
printf("root=%s\n", s);
|
|
|
16aa69 |
}
|
|
|
16aa69 |
|
|
|
16aa69 |
- line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines);
|
|
|
16aa69 |
|
|
|
16aa69 |
if (line && line->numElements >= 2) {
|
|
|
16aa69 |
if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
|
|
|
16aa69 |
@@ -2729,7 +2744,7 @@ struct singleLine * addLineTmpl(struct singleEntry * entry,
|
|
|
16aa69 |
insertElement(newLine, val, 1, cfi);
|
|
|
16aa69 |
|
|
|
16aa69 |
/* but try to keep the rootspec from the template... sigh */
|
|
|
16aa69 |
- if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI)) {
|
|
|
16aa69 |
+ if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) {
|
|
|
16aa69 |
char * rootspec = getRootSpecifier(tmplLine->elements[1].item);
|
|
|
16aa69 |
if (rootspec != NULL) {
|
|
|
16aa69 |
free(newLine->elements[1].item);
|
|
|
16aa69 |
@@ -3099,7 +3114,7 @@ int updateActualImage(struct grubConfig * cfg, const char * image,
|
|
|
16aa69 |
firstElement = 2;
|
|
|
16aa69 |
|
|
|
16aa69 |
} else {
|
|
|
16aa69 |
- line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
|
|
16aa69 |
if (!line) {
|
|
|
16aa69 |
/* no LT_KERNEL or LT_MBMODULE in this entry? */
|
|
|
16aa69 |
continue;
|
|
|
16aa69 |
@@ -3300,10 +3315,10 @@ int updateInitrd(struct grubConfig * cfg, const char * image,
|
|
|
16aa69 |
if (!image) return 0;
|
|
|
16aa69 |
|
|
|
16aa69 |
for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {
|
|
|
16aa69 |
- kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI, entry->lines);
|
|
|
16aa69 |
+ kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
|
|
16aa69 |
if (!kernelLine) continue;
|
|
|
16aa69 |
|
|
|
16aa69 |
- line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines);
|
|
|
16aa69 |
if (line)
|
|
|
16aa69 |
removeLine(entry, line);
|
|
|
16aa69 |
if (prefix) {
|
|
|
16aa69 |
@@ -3314,8 +3329,21 @@ int updateInitrd(struct grubConfig * cfg, const char * image,
|
|
|
16aa69 |
endLine = getLineByType(LT_ENTRY_END, entry->lines);
|
|
|
16aa69 |
if (endLine)
|
|
|
16aa69 |
removeLine(entry, endLine);
|
|
|
16aa69 |
- line = addLine(entry, cfg->cfi, preferredLineType(LT_INITRD, cfg->cfi),
|
|
|
16aa69 |
- kernelLine->indent, initrd);
|
|
|
16aa69 |
+ enum lineType_e lt;
|
|
|
16aa69 |
+ switch(kernelLine->type) {
|
|
|
16aa69 |
+ case LT_KERNEL:
|
|
|
16aa69 |
+ lt = LT_INITRD;
|
|
|
16aa69 |
+ break;
|
|
|
16aa69 |
+ case LT_KERNEL_EFI:
|
|
|
16aa69 |
+ lt = LT_INITRD_EFI;
|
|
|
16aa69 |
+ break;
|
|
|
16aa69 |
+ case LT_KERNEL_16:
|
|
|
16aa69 |
+ lt = LT_INITRD_16;
|
|
|
16aa69 |
+ break;
|
|
|
16aa69 |
+ default:
|
|
|
16aa69 |
+ lt = preferredLineType(LT_INITRD, cfg->cfi);
|
|
|
16aa69 |
+ }
|
|
|
16aa69 |
+ line = addLine(entry, cfg->cfi, lt, kernelLine->indent, initrd);
|
|
|
16aa69 |
if (!line)
|
|
|
16aa69 |
return 1;
|
|
|
16aa69 |
if (endLine) {
|
|
|
16aa69 |
@@ -3913,6 +3941,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template,
|
|
|
16aa69 |
switch (config->cfi->entryStart) {
|
|
|
16aa69 |
case LT_KERNEL:
|
|
|
16aa69 |
case LT_KERNEL_EFI:
|
|
|
16aa69 |
+ case LT_KERNEL_16:
|
|
|
16aa69 |
if (new->multiboot && config->cfi->mbHyperFirst) {
|
|
|
16aa69 |
/* fall through to LT_HYPER */
|
|
|
16aa69 |
} else {
|
|
|
16aa69 |
@@ -4471,7 +4500,7 @@ int main(int argc, const char ** argv) {
|
|
|
16aa69 |
if (!entry) return 0;
|
|
|
16aa69 |
if (!suitableImage(entry, bootPrefix, 0, flags)) return 0;
|
|
|
16aa69 |
|
|
|
16aa69 |
- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);
|
|
|
16aa69 |
+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
|
|
|
16aa69 |
if (!line) return 0;
|
|
|
16aa69 |
|
|
|
16aa69 |
rootspec = getRootSpecifier(line->elements[1].item);
|
|
|
16aa69 |
diff --git a/test.sh b/test.sh
|
|
|
16aa69 |
index 17b40fe..5be4006 100755
|
|
|
16aa69 |
--- a/test.sh
|
|
|
16aa69 |
+++ b/test.sh
|
|
|
16aa69 |
@@ -536,6 +536,22 @@ if [ "$testgrub2" == "y" ]; then
|
|
|
16aa69 |
|
|
|
16aa69 |
testing="GRUB2 --default-index with default=saved_entry and empty grubenv"
|
|
|
16aa69 |
grub2DisplayTest grub2.8 defaultindex/0 --env grubenv.0 --default-index
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+ testlinux16=n
|
|
|
16aa69 |
+ case $ARCH in
|
|
|
16aa69 |
+ ia32|x86_64) testlinux16=y ;;
|
|
|
16aa69 |
+ esac
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+ if [ "$testlinux16" == "y" ]; then
|
|
|
16aa69 |
+ testing="GRUB2 add kernel with linux16"
|
|
|
16aa69 |
+ grub2Test grub2.10 add/g2-1.10 --add-kernel=/boot/new-kernel.img \
|
|
|
16aa69 |
+ --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
|
|
|
16aa69 |
+ --copy-default
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+ testing="GRUB2 add initrd with linux16"
|
|
|
16aa69 |
+ grub2Test grub2.11 add/g2-1.11 --update-kernel=/boot/new-kernel.img \
|
|
|
16aa69 |
+ --initrd=/boot/new-initrd --boot-filesystem=/boot/
|
|
|
16aa69 |
+ fi
|
|
|
16aa69 |
fi
|
|
|
16aa69 |
|
|
|
16aa69 |
testing="YABOOT add kernel"
|
|
|
16aa69 |
diff --git a/test/grub2.10 b/test/grub2.10
|
|
|
16aa69 |
new file mode 100644
|
|
|
16aa69 |
index 0000000..d010783
|
|
|
16aa69 |
--- /dev/null
|
|
|
16aa69 |
+++ b/test/grub2.10
|
|
|
16aa69 |
@@ -0,0 +1,84 @@
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# DO NOT EDIT THIS FILE
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
16aa69 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
16aa69 |
+if [ -s $prefix/grubenv ]; then
|
|
|
16aa69 |
+ load_env
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+set default="0"
|
|
|
16aa69 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
16aa69 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ set prev_saved_entry=
|
|
|
16aa69 |
+ save_env prev_saved_entry
|
|
|
16aa69 |
+ set boot_once=true
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function savedefault {
|
|
|
16aa69 |
+ if [ -z "${boot_once}" ]; then
|
|
|
16aa69 |
+ saved_entry="${chosen}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ fi
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function load_video {
|
|
|
16aa69 |
+ insmod vbe
|
|
|
16aa69 |
+ insmod vga
|
|
|
16aa69 |
+ insmod video_bochs
|
|
|
16aa69 |
+ insmod video_cirrus
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+set timeout=5
|
|
|
16aa69 |
+### END /etc/grub.d/00_header ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+### END /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
16aa69 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
16aa69 |
+# the 'exec tail' line above.
|
|
|
16aa69 |
+### END /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+if [ -f $prefix/custom.cfg ]; then
|
|
|
16aa69 |
+ source $prefix/custom.cfg;
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+### END /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
+### END /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
diff --git a/test/grub2.11 b/test/grub2.11
|
|
|
16aa69 |
new file mode 100644
|
|
|
16aa69 |
index 0000000..820880a
|
|
|
16aa69 |
--- /dev/null
|
|
|
16aa69 |
+++ b/test/grub2.11
|
|
|
16aa69 |
@@ -0,0 +1,97 @@
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# DO NOT EDIT THIS FILE
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
16aa69 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
16aa69 |
+if [ -s $prefix/grubenv ]; then
|
|
|
16aa69 |
+ load_env
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+set default="0"
|
|
|
16aa69 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
16aa69 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ set prev_saved_entry=
|
|
|
16aa69 |
+ save_env prev_saved_entry
|
|
|
16aa69 |
+ set boot_once=true
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function savedefault {
|
|
|
16aa69 |
+ if [ -z "${boot_once}" ]; then
|
|
|
16aa69 |
+ saved_entry="${chosen}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ fi
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function load_video {
|
|
|
16aa69 |
+ insmod vbe
|
|
|
16aa69 |
+ insmod vga
|
|
|
16aa69 |
+ insmod video_bochs
|
|
|
16aa69 |
+ insmod video_cirrus
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+set timeout=5
|
|
|
16aa69 |
+### END /etc/grub.d/00_header ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+set superusers="foo bar baz"
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+menuentry 'title' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading title'
|
|
|
16aa69 |
+ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Linux 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Linux 2.6.38.8-32.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+### END /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
16aa69 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
16aa69 |
+# the 'exec tail' line above.
|
|
|
16aa69 |
+### END /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+if [ -f $prefix/custom.cfg ]; then
|
|
|
16aa69 |
+ source $prefix/custom.cfg;
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+### END /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
+### END /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
diff --git a/test/results/add/g2-1.10 b/test/results/add/g2-1.10
|
|
|
16aa69 |
new file mode 100644
|
|
|
16aa69 |
index 0000000..bb2c71c
|
|
|
16aa69 |
--- /dev/null
|
|
|
16aa69 |
+++ b/test/results/add/g2-1.10
|
|
|
16aa69 |
@@ -0,0 +1,96 @@
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# DO NOT EDIT THIS FILE
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
16aa69 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
16aa69 |
+if [ -s $prefix/grubenv ]; then
|
|
|
16aa69 |
+ load_env
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+set default="1"
|
|
|
16aa69 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
16aa69 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ set prev_saved_entry=
|
|
|
16aa69 |
+ save_env prev_saved_entry
|
|
|
16aa69 |
+ set boot_once=true
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function savedefault {
|
|
|
16aa69 |
+ if [ -z "${boot_once}" ]; then
|
|
|
16aa69 |
+ saved_entry="${chosen}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ fi
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function load_video {
|
|
|
16aa69 |
+ insmod vbe
|
|
|
16aa69 |
+ insmod vga
|
|
|
16aa69 |
+ insmod video_bochs
|
|
|
16aa69 |
+ insmod video_cirrus
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+set timeout=5
|
|
|
16aa69 |
+### END /etc/grub.d/00_header ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+menuentry 'title' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading title'
|
|
|
16aa69 |
+ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /new-initrd
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+### END /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
16aa69 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
16aa69 |
+# the 'exec tail' line above.
|
|
|
16aa69 |
+### END /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+if [ -f $prefix/custom.cfg ]; then
|
|
|
16aa69 |
+ source $prefix/custom.cfg;
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+### END /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
+### END /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
diff --git a/test/results/add/g2-1.11 b/test/results/add/g2-1.11
|
|
|
16aa69 |
new file mode 100644
|
|
|
16aa69 |
index 0000000..a11cb41
|
|
|
16aa69 |
--- /dev/null
|
|
|
16aa69 |
+++ b/test/results/add/g2-1.11
|
|
|
16aa69 |
@@ -0,0 +1,98 @@
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# DO NOT EDIT THIS FILE
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
16aa69 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
16aa69 |
+#
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
16aa69 |
+if [ -s $prefix/grubenv ]; then
|
|
|
16aa69 |
+ load_env
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+set default="0"
|
|
|
16aa69 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
16aa69 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ set prev_saved_entry=
|
|
|
16aa69 |
+ save_env prev_saved_entry
|
|
|
16aa69 |
+ set boot_once=true
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function savedefault {
|
|
|
16aa69 |
+ if [ -z "${boot_once}" ]; then
|
|
|
16aa69 |
+ saved_entry="${chosen}"
|
|
|
16aa69 |
+ save_env saved_entry
|
|
|
16aa69 |
+ fi
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+function load_video {
|
|
|
16aa69 |
+ insmod vbe
|
|
|
16aa69 |
+ insmod vga
|
|
|
16aa69 |
+ insmod video_bochs
|
|
|
16aa69 |
+ insmod video_cirrus
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+set timeout=5
|
|
|
16aa69 |
+### END /etc/grub.d/00_header ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+set superusers="foo bar baz"
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+menuentry 'title' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading title'
|
|
|
16aa69 |
+ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /new-initrd
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Linux 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Linux 2.6.38.8-32.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
16aa69 |
+ load_video
|
|
|
16aa69 |
+ set gfxpayload=keep
|
|
|
16aa69 |
+ insmod part_msdos
|
|
|
16aa69 |
+ insmod ext2
|
|
|
16aa69 |
+ set root='(hd0,msdos1)'
|
|
|
16aa69 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
16aa69 |
+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...'
|
|
|
16aa69 |
+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
16aa69 |
+ echo 'Loading initial ramdisk ...'
|
|
|
16aa69 |
+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img
|
|
|
16aa69 |
+}
|
|
|
16aa69 |
+### END /etc/grub.d/10_linux ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
16aa69 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
16aa69 |
+# the 'exec tail' line above.
|
|
|
16aa69 |
+### END /etc/grub.d/40_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+if [ -f $prefix/custom.cfg ]; then
|
|
|
16aa69 |
+ source $prefix/custom.cfg;
|
|
|
16aa69 |
+fi
|
|
|
16aa69 |
+### END /etc/grub.d/41_custom ###
|
|
|
16aa69 |
+
|
|
|
16aa69 |
+### BEGIN /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
+### END /etc/grub.d/90_persistent ###
|
|
|
16aa69 |
--
|
|
|
16aa69 |
2.4.3
|
|
|
16aa69 |
|