The actual startup for Fedora 21 is rapidly approaching and I would like to see grubby updated in rawhide sooner rather than later so that the full testing process can be used to reveal any "undesirable features."
The version of anaconda installer in rawhide has been updated to support /boot on both btrfs and an LVMlv.
The primary objective of this update is to add support for /boot on btrfs. However, it also includes some related updates with respect to LVMlv support and the basic operation of grubby. Rather than having one giant update, this has been broken up into 8 patch files which (hopefully) will be easier to understand.
1. Add code to limit the scan of a grub2 configuration file for a valid template to that to the main menu section. 2. Add support for /boot on btrfs subvol or <dir> under rootrf on btrfs subvol. 3. Add compile-time enabled debugging for btrfs support 4. Add tests for btrfs support 5. Add new run-time option to disable output from compile-time enabling of DEBUG. 6. Enable DEBUG (for now a good idea but can be disabled once there is confidence in new updates) ... perhaps DEBUG should always be enabled and a new runtime parameter enables output. For now it is what it is. 7. Similar to the regression tests for BTRFS support, add regression tests for /boot on LVMlv support. 8. The test files to support #7.
Gene Czarcinski (8): v2 add code to validate a grub2 entry v2.2 add support for btrfs when grub2 is bootloader v2.1 add compile-time enabled debugging code for btrfs v2.1 add tests for btrfs support add disable-debug runtime option Enable DEBUG regression test to verify that boot on LVMlv supported files for LVMlv regressions tests
grubby.c | 312 +++++++++++++++++++++++++++++++++++++++++++---- test.sh | 78 +++++++++++- test/grub2.15 | 126 +++++++++++++++++++ test/grub2.16 | 140 +++++++++++++++++++++ test/grub2.17 | 128 +++++++++++++++++++ test/grub2.18 | 143 ++++++++++++++++++++++ test/grub2.19 | 126 +++++++++++++++++++ test/grub2.20 | 128 +++++++++++++++++++ test/grub2.21 | 128 +++++++++++++++++++ test/grub2.22 | 143 ++++++++++++++++++++++ test/grub2.23 | 128 +++++++++++++++++++ test/grub2.24 | 143 ++++++++++++++++++++++ test/grub2.25 | 128 +++++++++++++++++++ test/grub2.26 | 128 +++++++++++++++++++ test/results/add/g2-1.15 | 140 +++++++++++++++++++++ test/results/add/g2-1.16 | 141 +++++++++++++++++++++ test/results/add/g2-1.17 | 143 ++++++++++++++++++++++ test/results/add/g2-1.18 | 144 ++++++++++++++++++++++ test/results/add/g2-1.19 | 141 +++++++++++++++++++++ test/results/add/g2-1.20 | 144 ++++++++++++++++++++++ test/results/add/g2-1.21 | 143 ++++++++++++++++++++++ test/results/add/g2-1.22 | 144 ++++++++++++++++++++++ test/results/add/g2-1.23 | 143 ++++++++++++++++++++++ test/results/add/g2-1.24 | 144 ++++++++++++++++++++++ test/results/add/g2-1.25 | 144 ++++++++++++++++++++++ test/results/add/g2-1.26 | 144 ++++++++++++++++++++++ test/results/debug/g2.1 | 2 +- 27 files changed, 3669 insertions(+), 27 deletions(-) create mode 100644 test/grub2.15 create mode 100644 test/grub2.16 create mode 100644 test/grub2.17 create mode 100644 test/grub2.18 create mode 100644 test/grub2.19 create mode 100644 test/grub2.20 create mode 100644 test/grub2.21 create mode 100644 test/grub2.22 create mode 100644 test/grub2.23 create mode 100644 test/grub2.24 create mode 100644 test/grub2.25 create mode 100644 test/grub2.26 create mode 100644 test/results/add/g2-1.15 create mode 100644 test/results/add/g2-1.16 create mode 100644 test/results/add/g2-1.17 create mode 100644 test/results/add/g2-1.18 create mode 100644 test/results/add/g2-1.19 create mode 100644 test/results/add/g2-1.20 create mode 100644 test/results/add/g2-1.21 create mode 100644 test/results/add/g2-1.22 create mode 100644 test/results/add/g2-1.23 create mode 100644 test/results/add/g2-1.24 create mode 100644 test/results/add/g2-1.25 create mode 100644 test/results/add/g2-1.26
Add findValidEntryByIndex() to test for the comment "### END /etc/grub.d/10_linux ###" indicating that the previous entry was the last "valid" entry. This prevents findTemplate() from looking at entries created by 30_os-prober and 40_custom.
This new function is currently only used in findTemplate() --- grubby.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-)
diff --git a/grubby.c b/grubby.c index 88a1f08..e47e97b 100644 --- a/grubby.c +++ b/grubby.c @@ -148,6 +148,7 @@ typedef const int (*writeLineFunc)(struct configFileInfo *, struct singleLine *line); typedef char *(*getEnvFunc)(struct configFileInfo *, char *name); typedef int (*setEnvFunc)(struct configFileInfo *, char *name, char *value); +typedef int (*validateEntryFunc)(struct singleEntry *entry);
struct configFileInfo { char * defaultConfig; @@ -155,6 +156,7 @@ struct configFileInfo { writeLineFunc writeLine; getEnvFunc getEnv; setEnvFunc setEnv; + validateEntryFunc validateEntry; struct keywordTypes * keywords; int caseInsensitive; int defaultIsIndex; @@ -473,10 +475,29 @@ char *grub2ExtractTitle(struct singleLine * line) { return result; }
+static const char * endOfValidGrub2Entries = "### END /etc/grub.d/10_linux ###"; + +int grub2ValidateEntry(struct singleEntry *entry) { + struct singleLine * line = entry->lines; + while(line != NULL) { + if ((line->numElements == 0) && + (line->type == LT_WHITESPACE) && + (line->indent != NULL) && + (strcmp(line->indent, endOfValidGrub2Entries) == 0)) { + dbgPrintf("findEntryByIndex() end valid entries: %s\n", + endOfValidGrub2Entries); + return 0; + } + line = line->next; + } + return -1; +} + struct configFileInfo grub2ConfigType = { .findConfig = grub2FindConfig, .getEnv = grub2GetEnv, .setEnv = grub2SetEnv, + .validateEntry = grub2ValidateEntry, .keywords = grub2Keywords, .defaultIsIndex = 1, .defaultSupportSaved = 1, @@ -654,6 +675,7 @@ struct grubConfig { blkid_cache blkid;
struct singleEntry * findEntryByIndex(struct grubConfig * cfg, int index); +struct singleEntry * findValidEntryByIndex(struct grubConfig * cfg, int index); struct singleEntry * findEntryByPath(struct grubConfig * cfg, const char * path, const char * prefix, int * index); @@ -2096,6 +2118,30 @@ struct singleEntry * findEntryByIndex(struct grubConfig * cfg, int index) { return entry; }
+/* ** code added to detect end of valid entries ** */ +/* A separate function because other code may depend on currect functionality. */ +/* Right now, findTemplate() is the ony use but there may be other places */ +/* this should be used instead of findEntryByIndex. */ +struct singleEntry * findValidEntryByIndex(struct grubConfig * cfg, int index) { + struct singleEntry * entry; + + entry = cfg->entries; + while (index && entry) { + entry = entry->next; + index--; + } + + if (entry == NULL) + return NULL; + + if (cfg->cfi->validateEntry) { + if (!cfg->cfi->validateEntry(entry)) + return NULL; + } + + return entry; +} + /* Find a good template to use for the new kernel. An entry is * good if the kernel and mkinitrd exist (even if the entry * is going to be removed). Try and use the default entry, but @@ -2113,16 +2159,21 @@ struct singleEntry * findTemplate(struct grubConfig * cfg, const char * prefix, int index = 0; if (isnumber(defTitle)) { index = atoi(defTitle); - entry = findEntryByIndex(cfg, index); + entry = findValidEntryByIndex(cfg, index); } else { entry = findEntryByTitle(cfg, defTitle, &index); } - if (entry) + if (entry) { cfg->defaultImage = index; + if (suitableImage(entry, prefix, skipRemoved, flags)) { + dbgPrintf("suitable template found based on saved_entry"); + return entry; + } + } } } } else if (cfg->defaultImage > -1) { - entry = findEntryByIndex(cfg, cfg->defaultImage); + entry = findValidEntryByIndex(cfg, cfg->defaultImage); if (entry && suitableImage(entry, prefix, skipRemoved, flags)) { if (indexPtr) *indexPtr = cfg->defaultImage; return entry; @@ -2130,7 +2181,7 @@ struct singleEntry * findTemplate(struct grubConfig * cfg, const char * prefix, }
index = 0; - while ((entry = findEntryByIndex(cfg, index))) { + while ((entry = findValidEntryByIndex(cfg, index))) { if (suitableImage(entry, prefix, skipRemoved, flags)) { int j; for (j = 0; j < index; j++) {
This patch adds getSubvolPrefix() for handling a btrfs subvol prefix on the filenames for grub2. If get_Root_Specifier() results in a NULL rootspec, then getSubvolPrefix() is executed to extract any btrfs subvol prefix. With this modification, booting off /boot on a btrfs subvol is supported.
To determine if booting is to be performed off a btrfs volume or subvolume, the lines of the entry are scanned to detect if "insmod btrfs" is present. If it is, then btrfs is assumed.
If the kernel filename includes only one slash, then there is no btrfs prefix. Otherwise, the first part defined by "/../" will be the btrfs prefix if booting btrfs. Unless, of course, there are 2 slashes in the filename but bootPrefix is zero length in which case we are booting off a btrfs volume!
Besides the kernel, the subvol prefix must also be on the initrd filename. The subvol prefix for initrd is based on the entry's kernel's filename. Note that the lines of the entry must be scanned to determine if we are booting on btrfs.
Code was added to addLine(tmpl() so that the subvol prefix not added for an initrd since updateInitrd() does that already. --- grubby.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 124 insertions(+), 8 deletions(-)
diff --git a/grubby.c b/grubby.c index e47e97b..773f55e 100644 --- a/grubby.c +++ b/grubby.c @@ -690,6 +690,8 @@ static int lineWrite(FILE * out, struct singleLine * line, static int getNextLine(char ** bufPtr, struct singleLine * line, struct configFileInfo * cfi); static char * getRootSpecifier(char * str); +static char * getSubvolPrefix(struct singleLine * line, char * str); +static char * findBootPrefix(void); static void requote(struct singleLine *line, struct configFileInfo * cfi); static void insertElement(struct singleLine * line, const char * item, int insertHere, @@ -1843,6 +1845,57 @@ static int endswith(const char *s, char c) return s[slen] == c; }
+ +/* extract any btrfs prefix on filename */ +/* the passed string is elements[1] */ +static char * getSubvolPrefix(struct singleLine * line, char * str) { + char *idx, *svPrefix = NULL; + int slashcnt = 0; + const char * bootPrefix = findBootPrefix(); + static int btrfsBootFlag = 0; + + if (btrfsBootFlag == 0){ + for (; line; line = line->next) { + dbgPrintf("checkForBtrfsBoot(%s)\n", + line->numElements >0 ? line->elements[0].item : ""); + if (line->numElements >1) { + if ((strcasecmp(line->elements[0].item,"insmod")==0) && + (strcasecmp(line->elements[1].item,"btrfs")==0)) { + dbgPrintf("NOTE: booting from a btrfs volume or subvolume\n"); + btrfsBootFlag = -1; + break; + } + } + } + } + + idx = str; + while (*idx) { + if (*idx == '/') + slashcnt++; + idx++; + } + + if ((btrfsBootFlag == 0) || + (slashcnt == 0) || + (slashcnt == 1)) + svPrefix = NULL; + + else if ((slashcnt == 2) && (strlen(bootPrefix) == 0)) + svPrefix = NULL; + + else if ((btrfsBootFlag == -1) && (*str == '/')) { + idx = svPrefix = strdup(str); + idx++; + while(*idx && (*idx != '/') && (!isspace(*idx))) idx++; + *idx = '\0'; /* strip off the second slash */ + } + dbgPrintf("getSubvolPrefix(): btrfsBootFlag=%i, slashcnt=%i, str='%s', bootPrefix='%s', svPrefix='%s'\n", + btrfsBootFlag, slashcnt, str, bootPrefix, svPrefix); + + return svPrefix; +} + int suitableImage(struct singleEntry * entry, const char * bootPrefix, int skipRemoved, int flags) { struct singleLine * line; @@ -1873,14 +1926,21 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, return 1; }
+ dbgPrintf("suitableImage(), bootPrefix='%s', type='%s'\n", + bootPrefix, line->elements[0].item); fullName = alloca(strlen(bootPrefix) + strlen(line->elements[1].item) + 1); rootspec = getRootSpecifier(line->elements[1].item); + if (rootspec == NULL) { + rootspec = getSubvolPrefix(entry->lines, line->elements[1].item); + } int rootspec_offset = rootspec ? strlen(rootspec) : 0; int hasslash = endswith(bootPrefix, '/') || beginswith(line->elements[1].item + rootspec_offset, '/'); sprintf(fullName, "%s%s%s", bootPrefix, hasslash ? "" : "/", line->elements[1].item + rootspec_offset); + dbgPrintf("suitbleImage(): fullName='%s' root/subvol prefix='%s'\n", + fullName, (rootspec != NULL) ? rootspec : ""); if (access(fullName, R_OK)) { notSuitablePrintf(entry, 0, "access to %s failed\n", fullName); return 0; @@ -2052,11 +2112,17 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, if (line && line->type != LT_MENUENTRY && line->numElements >= 2) { rootspec = getRootSpecifier(line->elements[1].item); + if (rootspec == NULL) { + rootspec = getSubvolPrefix(entry->lines, line->elements[1].item); + } if (!strcmp(line->elements[1].item + ((rootspec != NULL) ? strlen(rootspec) : 0), kernel + strlen(prefix))) break; } + if(line->type == LT_MENUENTRY) + dbgPrintf("findEntryByPath: got:'%s', wanted='%s'\n", + line->elements[1].item, kernel); if(line->type == LT_MENUENTRY && !strcmp(line->elements[1].item, kernel)) break; @@ -2201,7 +2267,7 @@ struct singleEntry * findTemplate(struct grubConfig * cfg, const char * prefix, return NULL; }
-char * findBootPrefix(void) { +static char * findBootPrefix(void) { struct stat sb, sb2;
stat("/", &sb); @@ -2828,17 +2894,23 @@ struct singleLine * addLineTmpl(struct singleEntry * entry, /* but try to keep the rootspec from the template... sigh */ if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) { char * rootspec = getRootSpecifier(tmplLine->elements[1].item); + if ((rootspec == NULL) && (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16))) { + rootspec = getSubvolPrefix(entry->lines, tmplLine->elements[1].item); + } if (rootspec != NULL) { free(newLine->elements[1].item); newLine->elements[1].item = sdupprintf("%s%s", rootspec, val); } } + dbgPrintf("addLineTmpl(%s), type= 0x%x '%s'\n", + newLine->elements[0].item, tmplLine->type, + newLine->elements[1].item); + } else { + dbgPrintf("addLineTmpl(%s), type= 0x%x\n", newLine->numElements ? + newLine->elements[0].item : "", tmplLine->type); }
- dbgPrintf("addLineTmpl(%s)\n", newLine->numElements ? - newLine->elements[0].item : ""); - if (!entry->lines) { /* first one on the list */ entry->lines = newLine; @@ -3357,23 +3429,40 @@ int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel, struct singleEntry * entry; struct singleLine * line, * kernelLine, *endLine = NULL; int index = 0; + char * svPrefix = NULL; + char * newInitrd = NULL;
if (!image) return 0; + dbgPrintf("addMBInitrd(), image='%s', prefix='%s', initrd='%s'\n", + image, prefix, initrd);
for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) { kernelLine = getLineByType(LT_MBMODULE, entry->lines); if (!kernelLine) continue; + dbgPrintf("... index=%i, kernel: %s '%s'\n", index, + kernelLine->elements[0].item, + kernelLine->elements[1].item); + svPrefix = getSubvolPrefix(entry->lines, kernelLine->elements[1].item);
if (prefix) { int prefixLen = strlen(prefix); if (!strncmp(initrd, prefix, prefixLen)) initrd += prefixLen; } + if (svPrefix) { + newInitrd = alloca(strlen(svPrefix) + strlen(initrd) + 2); + strcpy(newInitrd, svPrefix); + strcat(newInitrd, initrd); + } else + newInitrd = (char *)initrd; + dbgPrintf("... updated initrd='%s'\n", newInitrd); endLine = getLineByType(LT_ENTRY_END, entry->lines); if (endLine) removeLine(entry, endLine); line = addLine(entry, cfg->cfi, preferredLineType(LT_MBMODULE,cfg->cfi), - kernelLine->indent, initrd); + kernelLine->indent, newInitrd); + if (svPrefix) + free(svPrefix); if (!line) return 1; if (endLine) { @@ -3393,12 +3482,20 @@ int updateInitrd(struct grubConfig * cfg, const char * image, struct singleEntry * entry; struct singleLine * line, * kernelLine, *endLine = NULL; int index = 0; + char * svPrefix = NULL; + char * newInitrd = NULL;
if (!image) return 0; + dbgPrintf("updateInitrd(), image='%s', prefix='%s', initrd='%s'\n", + image, prefix, initrd);
for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) { kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); if (!kernelLine) continue; + dbgPrintf("... index=%i, kernel: %s '%s'\n", index, + kernelLine->elements[0].item, + kernelLine->elements[1].item); + svPrefix = getSubvolPrefix(entry->lines, kernelLine->elements[1].item);
line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines); if (line) @@ -3408,6 +3505,13 @@ int updateInitrd(struct grubConfig * cfg, const char * image, if (!strncmp(initrd, prefix, prefixLen)) initrd += prefixLen; } + if (svPrefix) { + newInitrd = alloca(strlen(svPrefix) + strlen(initrd) + 2); + strcpy(newInitrd, svPrefix); + strcat(newInitrd, initrd); + } else + newInitrd = (char *)initrd; + dbgPrintf("... updated initrd='%s'\n", newInitrd); endLine = getLineByType(LT_ENTRY_END, entry->lines); if (endLine) removeLine(entry, endLine); @@ -3425,7 +3529,9 @@ int updateInitrd(struct grubConfig * cfg, const char * image, default: lt = preferredLineType(LT_INITRD, cfg->cfi); } - line = addLine(entry, cfg->cfi, lt, kernelLine->indent, initrd); + line = addLine(entry, cfg->cfi, lt, kernelLine->indent, newInitrd); + if (svPrefix) + free(svPrefix); if (!line) return 1; if (endLine) { @@ -3790,6 +3896,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, struct singleLine * newLine = NULL, * tmplLine = NULL, * masterLine = NULL; int needs; char * chptr; + char * svPrefix = NULL;
if (!newKernelPath) return 0;
@@ -3885,6 +3992,8 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, newLine = addLineTmpl(new, tmplLine, newLine, newKernelPath + strlen(prefix), config->cfi); needs &= ~NEED_KERNEL; + /* save svPrefix in case we need to do initrd */ + svPrefix = getSubvolPrefix(new->lines, tmplLine->elements[1].item); }
} else if (tmplLine->type == LT_HYPER && @@ -3962,9 +4071,16 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, needs &= ~NEED_INITRD; } } else if (needs & NEED_INITRD) { - char *initrdVal; + char *initrdVal, *newInitrdVal = NULL; initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); - newLine = addLineTmpl(new, tmplLine, newLine, initrdVal, config->cfi); + if (svPrefix) { + newInitrdVal = alloca(strlen(svPrefix) + strlen(initrdVal)); + strcpy(newInitrdVal, svPrefix); + strcat(newInitrdVal, initrdVal); + } + else + newInitrdVal = initrdVal; + newLine = addLineTmpl(new, tmplLine, newLine, newInitrdVal, config->cfi); free(initrdVal); needs &= ~NEED_INITRD; }
This patch add a "bunch" of debugging code supporting the implementation of btrfs support. This code will only produce output if DEBUG is enabled. --- grubby.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 3 deletions(-)
diff --git a/grubby.c b/grubby.c index 773f55e..451d291 100644 --- a/grubby.c +++ b/grubby.c @@ -1395,7 +1395,14 @@ static struct grubConfig * readConfig(const char * inName, entry->lines = line; else last->next = line; - dbgPrintf("readConfig added %s to %p\n", getKeyByType(line->type, cfi), entry); + if ((line->numElements == 0) && (line->type == LT_WHITESPACE)) { + dbgPrintf("readConfig added %s to %p, comment='%s'\n", + getKeyByType(line->type, cfi), entry, + line->indent ? line->indent : ""); + } else { + dbgPrintf("readConfig added %s to %p\n", + getKeyByType(line->type, cfi), entry); + }
/* we could have seen this outside of an entry... if so, we * ignore it like any other line we don't grok */ @@ -1406,7 +1413,16 @@ static struct grubConfig * readConfig(const char * inName, cfg->theLines = line; else last->next = line; - dbgPrintf("readConfig added %s to cfg\n", getKeyByType(line->type, cfi)); + if ((line->numElements == 0) && (line->type == LT_WHITESPACE)) { + dbgPrintf("readConfig added %s to cfg, comment='%s'\n", + getKeyByType(line->type, cfi), + line->indent ? line->indent : ""); + } else { + dbgPrintf("readConfig added %s to cfg ... 0:'%s' 1:'%s'\n", + getKeyByType(line->type, cfi), + (line->numElements > 0) ? line->elements[0].item : "", + (line->numElements > 1) ? line->elements[1].item : ""); + } }
last = line; @@ -1501,6 +1517,7 @@ static void writeDefault(FILE * out, char * indent, struct singleLine * line; int i;
+ dbgPrintf("writeDefault() entered\n"); if (!cfg->defaultImage && cfg->flags == GRUB_CONFIG_NO_DEFAULT) return;
if (cfg->defaultImage == DEFAULT_SAVED) @@ -1556,6 +1573,7 @@ static void writeDefault(FILE * out, char * indent, } } } + dbgPrintf("writeDefault() done\n"); }
static int writeConfig(struct grubConfig * cfg, char * outName, @@ -1568,6 +1586,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName, struct stat sb; int i;
+ dbgPrintf("writeConfig() to outName='%s'\n", outName); if (!strcmp(outName, "-")) { out = stdout; tmpOutName = NULL; @@ -1619,6 +1638,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName,
line = cfg->theLines; struct keywordTypes *defaultKw = getKeywordByType(LT_DEFAULT, cfg->cfi); + dbgPrintf("writeConfig(): outputting the new config file\n"); while (line) { if (line->type == LT_SET_VARIABLE && defaultKw && line->numElements == 3 && @@ -1648,6 +1668,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName, }
if (needs & MAIN_DEFAULT) { + dbgPrintf("writeconfig() doing main default\n"); writeDefault(out, cfg->primaryIndent, "=", cfg); needs &= ~MAIN_DEFAULT; } @@ -1669,7 +1690,9 @@ static int writeConfig(struct grubConfig * cfg, char * outName, } }
+ dbgPrintf("writeConfig() done\n"); if (tmpOutName) { + dbgPrintf("writeConfig() renaming '%s' to '%s'\n", tmpOutName, outName); if (rename(tmpOutName, outName)) { fprintf(stderr, _("grubby: error moving %s to %s: %s\n"), tmpOutName, outName, strerror(errno)); @@ -1794,6 +1817,26 @@ void printEntry(struct singleEntry * entry, FILE *f) { } }
+#if DEBUG +void printEntries(struct grubConfig *cfg) { + struct singleEntry * entry; + int index = 0; + + entry = cfg->entries; + while (entry) { + if (!entry->skip) { + fprintf(stderr,"-------- entry=%i --------\n", index); + printEntry(entry, stderr); + fprintf(stderr,"-----end entry=%i --------\n", index); + index++; + } + else + fprintf(stderr,"-----skipping entry %i -----\n", index); + entry = entry->next; + } +} +#endif + void notSuitablePrintf(struct singleEntry * entry, int okay, const char *fmt, ...) { static int once; @@ -2935,6 +2978,7 @@ struct singleLine * addLine(struct singleEntry * entry, /* NB: This function shouldn't allocate items on the heap, rather on the * stack since it calls addLineTmpl which will make copies. */ + dbgPrintf("addLine(): type=%i 0x%x\n", type, type); if (type == LT_TITLE && cfi->titleBracketed) { /* we're doing a bracketed title (zipl) */ tmpl.type = type; @@ -3852,11 +3896,15 @@ static char * getInitrdVal(struct grubConfig * config,
prefixLen = strlen(prefix); totalSize = strlen(newKernelInitrd) - prefixLen + 1 /* \0 */; + dbgPrintf("getInitrdVal() prefixlen=%i totalsize=%i, newKernelInitrd='%s'\n", + (int)prefixLen, (int)totalSize, + newKernelInitrd);
for (i = 0; i < extraInitrdCount; i++) { totalSize += sizeof(separatorChar); totalSize += strlen(extraInitrds[i]) - prefixLen; } + dbgPrintf("... totalSize with extra initrd %i\n", (int)totalSize);
initrdVal = end = malloc(totalSize);
@@ -3936,12 +3984,17 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, if (newDevTreePath && getKeywordByType(LT_DEVTREE, config->cfi)) needs |= NEED_DEVTREE;
+ dbgPrintf("addNewKernel(): needs=0x%x\n", needs); if (template) { for (masterLine = template->lines; masterLine && (tmplLine = lineDup(masterLine)); lineFree(tmplLine), masterLine = masterLine->next) { - dbgPrintf("addNewKernel processing %d\n", tmplLine->type); + dbgPrintf("addNewKernel processing %d, 0x%x '%s', needs=0x%x, operand='%s'\n", + tmplLine->type, tmplLine->type, + tmplLine->numElements ? tmplLine->elements[0].item : "", + needs, + tmplLine->numElements>1 ? tmplLine->elements[1].item : "");
/* skip comments */ chptr = tmplLine->indent; @@ -3950,6 +4003,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template,
if (iskernel(tmplLine->type) && tmplLine->numElements >= 2) { if (!template->multiboot && (needs & NEED_MB)) { + dbgPrintf("addNewKernel: multiboot template\n"); /* it's not a multiboot template and this is the kernel * line. Try to be intelligent about inserting the * hypervisor at the same time. @@ -3978,17 +4032,22 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, free(tmplLine->elements[0].item); tmplLine->elements[0].item = strdup(mbm_kw->key); } + dbgPrintf("addNewKernel processing #1, new kernel path='%s'\n", + newKernelPath); newLine = addLineTmpl(new, tmplLine, newLine, newKernelPath + strlen(prefix), config->cfi); needs &= ~NEED_KERNEL; } if (needs & NEED_MB) { /* !mbHyperFirst */ + dbgPrintf("addNewKernel processing #2\n"); newLine = addLine(new, config->cfi, LT_HYPER, config->secondaryIndent, newMBKernel + strlen(prefix)); needs &= ~NEED_MB; } } else if (needs & NEED_KERNEL) { + dbgPrintf("addNewKernel processing #3, new kernel path='%s'\n", + newKernelPath); newLine = addLineTmpl(new, tmplLine, newLine, newKernelPath + strlen(prefix), config->cfi); needs &= ~NEED_KERNEL; @@ -3999,6 +4058,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, } else if (tmplLine->type == LT_HYPER && tmplLine->numElements >= 2) { if (needs & NEED_MB) { + dbgPrintf("addNewKernel processing #4 (LT_HYPER)\n"); newLine = addLineTmpl(new, tmplLine, newLine, newMBKernel + strlen(prefix), config->cfi); needs &= ~NEED_MB; @@ -4008,6 +4068,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, tmplLine->numElements >= 2) { if (new->multiboot) { if (needs & NEED_KERNEL) { + dbgPrintf("addNewKernel processing #5\n"); newLine = addLineTmpl(new, tmplLine, newLine, newKernelPath + strlen(prefix), config->cfi); @@ -4018,6 +4079,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); + dbgPrintf("addNewKernel processing #6\n"); newLine = addLineTmpl(new, tmplLine, newLine, initrdVal, config->cfi); free(initrdVal); @@ -4032,6 +4094,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, tmplLine->elements[0].item = strdup(getKeywordByType(tmplLine->type, config->cfi)->key); + dbgPrintf("addNewKernel processing #7\n"); newLine = addLineTmpl(new, tmplLine, newLine, newKernelPath + strlen(prefix), config->cfi); @@ -4047,6 +4110,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, strdup(getKeywordByType(tmplLine->type, config->cfi)->key); initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); + dbgPrintf("addNewKernel processing #8\n"); newLine = addLineTmpl(new, tmplLine, newLine, initrdVal, config->cfi); free(initrdVal); needs &= ~NEED_INITRD; @@ -4064,6 +4128,8 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, char *initrdVal; initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); + dbgPrintf("addNewKernel processing #9, MBMODULE='%s'\n", + initrdVal); newLine = addLine(new, config->cfi, LT_MBMODULE, config->secondaryIndent, initrdVal); @@ -4073,6 +4139,8 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, } else if (needs & NEED_INITRD) { char *initrdVal, *newInitrdVal = NULL; initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); + dbgPrintf("addNewKernel processing #10, initrdVal='%s', svPrefix='%s'\n", + initrdVal, svPrefix ? svPrefix : ""); if (svPrefix) { newInitrdVal = alloca(strlen(svPrefix) + strlen(initrdVal)); strcpy(newInitrdVal, svPrefix); @@ -4092,18 +4160,21 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, strcpy(nkt, "'"); strcat(nkt, newKernelTitle); strcat(nkt, "'"); + dbgPrintf("addNewKernel processing #11, new='%s'\n", nkt); newLine = addLineTmpl(new, tmplLine, newLine, nkt, config->cfi); free(nkt); needs &= ~NEED_TITLE; } else if (tmplLine->type == LT_TITLE && (needs & NEED_TITLE)) { if (tmplLine->numElements >= 2) { + dbgPrintf("addNewKernel processing #12\n"); newLine = addLineTmpl(new, tmplLine, newLine, newKernelTitle, config->cfi); needs &= ~NEED_TITLE; } else if (tmplLine->numElements == 1 && config->cfi->titleBracketed) { /* addLineTmpl doesn't handle titleBracketed */ + dbgPrintf("addNewKernel processing #13\n"); newLine = addLine(new, config->cfi, LT_TITLE, tmplLine->indent, newKernelTitle); needs &= ~NEED_TITLE; @@ -4121,6 +4192,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, strcpy(newTitle, prefix); strcat(newTitle, newKernelTitle); strcat(newTitle, "'"); + dbgPrintf("addNewKernel processing #14\n"); newLine = addLine(new, config->cfi, LT_ECHO, tmplLine->indent, newTitle); free(newTitle); @@ -4154,6 +4226,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, /* don't have a template, so start the entry with the * appropriate starting line */ + dbgPrintf("addNewKernel processing no template, create something anyway\n"); switch (config->cfi->entryStart) { case LT_KERNEL: case LT_KERNEL_EFI: @@ -4225,6 +4298,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, removeLine(new, endLine); needs |= NEED_END; } + dbgPrintf("addNewKernel(): done loop, needs=0x%x\n", needs);
/* add the remainder of the lines, i.e. those that either * weren't present in the template, or in the case of no template, @@ -4243,6 +4317,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, needs &= ~NEED_MB; } if (needs & NEED_KERNEL) { + dbgPrintf("addNewKernel processing #15\n"); newLine = addLine(new, config->cfi, (new->multiboot && getKeywordByType(LT_MBMODULE, config->cfi)) @@ -4293,6 +4368,12 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, if (updateImage(config, "0", prefix, newKernelArgs, NULL, newMBKernelArgs, NULL)) return 1;
+#if DEBUG + fprintf(stderr,"--end of addNewKernel()-----\n"); + printEntry(new, stderr); + fprintf(stderr,"--end of addNewKernel()-----\n"); +#endif + return 0; }
@@ -4467,6 +4548,7 @@ int main(int argc, const char ** argv) { strncat(saved_command_line, j == argc -1 ? "" : " ", 1); }
+ dbgPrintf("---> Begin grubby execution <------------------------------------\n"); optCon = poptGetContext("grubby", argc, argv, options, 0); poptReadDefaultConfig(optCon, 1);
@@ -4815,6 +4897,9 @@ int main(int argc, const char ** argv) { "Not writing out new config.\n")); return 1; } +#if DEBUG + printEntries(config); +#endif
if (!outputFile) outputFile = (char *)grubConfig;
The tests performed are: - add kernel with /boot on btrfs subvol (15) - update kernel/add initrd with /boot on btrfs subvol (16) - add kernel and initrd with /boot on btrfs subvol (19) - add kernel with rootfs on btrfs subvol and /boot a directory (17) - update kernel/add initrd with rootfs on btrfs subvol and /boot a directory (18) - add kernel and initrd with rootfs on btrfs subvol and /boot a directory (20) --- test.sh | 34 +++++++++++ test/grub2.15 | 126 +++++++++++++++++++++++++++++++++++++++++ test/grub2.16 | 140 +++++++++++++++++++++++++++++++++++++++++++++ test/grub2.17 | 128 +++++++++++++++++++++++++++++++++++++++++ test/grub2.18 | 143 ++++++++++++++++++++++++++++++++++++++++++++++ test/grub2.19 | 126 +++++++++++++++++++++++++++++++++++++++++ test/grub2.20 | 128 +++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.15 | 140 +++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.16 | 141 ++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.17 | 143 ++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.18 | 144 +++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.19 | 141 ++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.20 | 144 +++++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 1678 insertions(+) create mode 100644 test/grub2.15 create mode 100644 test/grub2.16 create mode 100644 test/grub2.17 create mode 100644 test/grub2.18 create mode 100644 test/grub2.19 create mode 100644 test/grub2.20 create mode 100644 test/results/add/g2-1.15 create mode 100644 test/results/add/g2-1.16 create mode 100644 test/results/add/g2-1.17 create mode 100644 test/results/add/g2-1.18 create mode 100644 test/results/add/g2-1.19 create mode 100644 test/results/add/g2-1.20
diff --git a/test.sh b/test.sh index 864a8ce..d98368b 100755 --- a/test.sh +++ b/test.sh @@ -619,6 +619,40 @@ if [ "$testgrub2" == "y" ]; then testing="GRUB2 add initrd with linux16" grub2Test grub2.11 add/g2-1.11 --update-kernel=/boot/new-kernel.img \ --initrd=/boot/new-initrd --boot-filesystem=/boot/ + + testing="GRUB2 add kernel with boot on btrfs subvol" + grub2Test grub2.15 add/g2-1.15 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --boot-filesystem=/boot/ \ + --copy-default + + testing="GRUB2 add initrd with boot on btrfs subvol" + grub2Test grub2.16 add/g2-1.16 --update-kernel=/boot/new-kernel.img \ + --initrd=/boot/new-initrd --boot-filesystem=/boot/ + + testing="GRUB2 add kernel with rootfs on btrfs subvol and boot directory" + grub2Test grub2.17 add/g2-1.17 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --boot-filesystem= \ + --copy-default + + testing="GRUB2 add initrd with rootfs on btrfs subvol and boot directory" + grub2Test grub2.18 add/g2-1.18 --update-kernel=/boot/new-kernel.img \ + --initrd=/boot/new-initrd --boot-filesystem= + + testing="GRUB2 add kernel and initrd with boot on btrfs subvol" + grub2Test grub2.19 add/g2-1.19 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --initrd=/boot/new-initrd \ + --boot-filesystem=/boot/ \ + --copy-default + + testing="GRUB2 add kernel and initrd with rootfs on btrfs subvol and boot directory" + grub2Test grub2.20 add/g2-1.20 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --initrd=/boot/new-initrd \ + --boot-filesystem= \ + --copy-default fi fi
diff --git a/test/grub2.15 b/test/grub2.15 new file mode 100644 index 0000000..23b75fa --- /dev/null +++ b/test/grub2.15 @@ -0,0 +1,126 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.16 b/test/grub2.16 new file mode 100644 index 0000000..579c2f6 --- /dev/null +++ b/test/grub2.16 @@ -0,0 +1,140 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.17 b/test/grub2.17 new file mode 100644 index 0000000..9466bc3 --- /dev/null +++ b/test/grub2.17 @@ -0,0 +1,128 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.18 b/test/grub2.18 new file mode 100644 index 0000000..5cb240f --- /dev/null +++ b/test/grub2.18 @@ -0,0 +1,143 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.19 b/test/grub2.19 new file mode 100644 index 0000000..23b75fa --- /dev/null +++ b/test/grub2.19 @@ -0,0 +1,126 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.20 b/test/grub2.20 new file mode 100644 index 0000000..9466bc3 --- /dev/null +++ b/test/grub2.20 @@ -0,0 +1,128 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.15 b/test/results/add/g2-1.15 new file mode 100644 index 0000000..579c2f6 --- /dev/null +++ b/test/results/add/g2-1.15 @@ -0,0 +1,140 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.16 b/test/results/add/g2-1.16 new file mode 100644 index 0000000..c0dded9 --- /dev/null +++ b/test/results/add/g2-1.16 @@ -0,0 +1,141 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.17 b/test/results/add/g2-1.17 new file mode 100644 index 0000000..5cb240f --- /dev/null +++ b/test/results/add/g2-1.17 @@ -0,0 +1,143 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.18 b/test/results/add/g2-1.18 new file mode 100644 index 0000000..c3e87cf --- /dev/null +++ b/test/results/add/g2-1.18 @@ -0,0 +1,144 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.19 b/test/results/add/g2-1.19 new file mode 100644 index 0000000..c0dded9 --- /dev/null +++ b/test/results/add/g2-1.19 @@ -0,0 +1,141 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + else + search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6 + fi + linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet + initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.20 b/test/results/add/g2-1.20 new file mode 100644 index 0000000..c3e87cf --- /dev/null +++ b/test/results/add/g2-1.20 @@ -0,0 +1,144 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod part_msdos + insmod btrfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' --hint='hd1,msdos3' 54c6abc2-b1e7-4987-aa73-c79927be69eb + else + search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb + fi + linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet + initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ###
To facilitate having compile-time DEBUG enabled and still being able to successfully run the tests, add a new --disable-debug parameter to grubby so that, even if compile-time DEBUG is enabled, the output will be suppressed.
This permits "make test" to be run.
Besides the changes to grubby, changing test.sh to use "./grubby --disable-debug" instead of "./grubby", only one test had to be slightly changed. --- grubby.c | 38 +++++++++++++++++++++++++++----------- test.sh | 8 ++++---- test/results/debug/g2.1 | 2 +- 3 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/grubby.c b/grubby.c index 451d291..a4a9e65 100644 --- a/grubby.c +++ b/grubby.c @@ -43,13 +43,18 @@ #endif
#if DEBUG -#define dbgPrintf(format, args...) fprintf(stderr, format , ## args) + #define dbgPrintf(format, args...) \ + if (!disableDebug) {\ + fprintf(stderr, format , ## args); \ + } #else -#define dbgPrintf(format, args...) + #define dbgPrintf(format, args...) #endif
int debug = 0; /* Currently just for template debugging */
+int disableDebug = 0; /* at runtime, disable output from compile-time DEBUG */ + #define _(A) (A)
#define MAX_EXTRA_INITRDS 16 /* code segment checked by --bootloader-probe */ @@ -2762,15 +2767,19 @@ int grubGetBootFromDeviceMap(const char * device, int suseGrubConfGetBoot(const char * path, char ** bootPtr) { char * grubDevice;
- if (suseGrubConfGetInstallDevice(path, &grubDevice)) + if (suseGrubConfGetInstallDevice(path, &grubDevice)) { dbgPrintf("error looking for grub installation device\n"); - else + } + else { dbgPrintf("grubby installation device: %s\n", grubDevice); + }
- if (grubGetBootFromDeviceMap(grubDevice, bootPtr)) + if (grubGetBootFromDeviceMap(grubDevice, bootPtr)) { dbgPrintf("error looking for grub boot device\n"); - else + } + else { dbgPrintf("grubby boot device: %s\n", *bootPtr); + }
free(grubDevice); return 0; @@ -4369,9 +4378,11 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, newMBKernelArgs, NULL)) return 1;
#if DEBUG - fprintf(stderr,"--end of addNewKernel()-----\n"); - printEntry(new, stderr); - fprintf(stderr,"--end of addNewKernel()-----\n"); + if (!disableDebug) { + fprintf(stderr,"--end of addNewKernel()-----\n"); + printEntry(new, stderr); + fprintf(stderr,"--end of addNewKernel()-----\n"); + } #endif
return 0; @@ -4471,6 +4482,8 @@ int main(int argc, const char ** argv) { _("display the title of the default kernel") }, { "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0, _("device tree file for new stanza"), _("dtb-path") }, + { "disable-debug", 0, 0, &disableDebug, 0, + _("at run-time, disable compile-time DEBUG output") }, { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0, _("configure elilo bootloader") }, { "efi", 0, POPT_ARG_NONE, &isEfi, 0, @@ -4548,7 +4561,6 @@ int main(int argc, const char ** argv) { strncat(saved_command_line, j == argc -1 ? "" : " ", 1); }
- dbgPrintf("---> Begin grubby execution <------------------------------------\n"); optCon = poptGetContext("grubby", argc, argv, options, 0); poptReadDefaultConfig(optCon, 1);
@@ -4581,6 +4593,8 @@ int main(int argc, const char ** argv) { return 1; }
+ dbgPrintf("---> Begin grubby execution <------------------------------------\n"); + if ((configureLilo + configureGrub2 + configureGrub + configureELilo + configureYaboot + configureSilo + configureZipl + configureExtLinux ) > 1) { @@ -4898,7 +4912,9 @@ int main(int argc, const char ** argv) { return 1; } #if DEBUG - printEntries(config); + if (!disableDebug) { + printEntries(config); + } #endif
if (!outputFile) diff --git a/test.sh b/test.sh index d98368b..d1e027b 100755 --- a/test.sh +++ b/test.sh @@ -62,7 +62,7 @@ oneTest() {
echo "$testing ... $mode $cfg $correct" - runme=( ./grubby "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - "$@" ) + runme=( ./grubby --disable-debug "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - "$@" ) if "${runme[@]}" | cmp "$correct" > /dev/null; then (( pass++ )) if $opt_verbose; then @@ -107,7 +107,7 @@ oneDisplayTest() { fi
echo "$testing ... $mode $cfg $correct" - runme=( ./grubby "$mode" $BIO $ENV_FILE -c "$cfg" "$@" ) + runme=( ./grubby --disable-debug "$mode" $BIO $ENV_FILE -c "$cfg" "$@" ) if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then (( pass++ )) if $opt_verbose; then @@ -211,7 +211,7 @@ for n in test/*.[0-9]*; do touch -t 200301010101.00 ${b}-test time=$(ls -l ${b}-test | awk '{ print $6 " " $7 " "$8}') perm=$(ls -l ${b}-test | awk '{print $1}') - ./grubby --${b} --add-kernel bar --title title -c ${b}-test + ./grubby --disable-debug --${b} --add-kernel bar --title title -c ${b}-test if [[ $? != 0 ]]; then echo " FAIL (grubby returned non-zero)" (( fail++ )) @@ -239,7 +239,7 @@ for n in test/*.[0-9]*; do
cp test/${b}.1 ${b}-test ln -s ./${b}-test mytest - ./grubby --${b} --add-kernel bar --title title -c mytest + ./grubby --disable-debug --${b} --add-kernel bar --title title -c mytest if [[ $? != 0 ]]; then echo " failed (grubby returned non-zero)" (( fail++ )) diff --git a/test/results/debug/g2.1 b/test/results/debug/g2.1 index f5187f5..c2c2fee 100644 --- a/test/results/debug/g2.1 +++ b/test/results/debug/g2.1 @@ -1,4 +1,4 @@ -DBG: command line: --grub2 --env=test/grub2-support_files/env_temp -c test/grub2.1 --boot-filesystem=/boot --default-kernel --debug +DBG: command line: --disable-debug --grub2 --env=test/grub2-support_files/env_temp -c test/grub2.1 --boot-filesystem=/boot --default-kernel --debug DBG: Image entry failed: access to /boot/vmlinuz-2.6.38.8-32.fc15.x86_64 failed DBG: menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { DBG: load_video
From: Gene Czarcinski gene@czarc.net
--- grubby.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grubby.c b/grubby.c index a4a9e65..8123457 100644 --- a/grubby.c +++ b/grubby.c @@ -39,7 +39,7 @@ #include "log.h"
#ifndef DEBUG -#define DEBUG 0 +#define DEBUG 1 #endif
#if DEBUG
With grub2-2.02 /boot on an LVMlv as well as /boot as a directory and rootrf on a LVMlv is supported. These tests verify that grubby supports the configurations. --- test.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/test.sh b/test.sh index d1e027b..a959521 100755 --- a/test.sh +++ b/test.sh @@ -620,6 +620,7 @@ if [ "$testgrub2" == "y" ]; then grub2Test grub2.11 add/g2-1.11 --update-kernel=/boot/new-kernel.img \ --initrd=/boot/new-initrd --boot-filesystem=/boot/
+ ### /boot on btrfs ### testing="GRUB2 add kernel with boot on btrfs subvol" grub2Test grub2.15 add/g2-1.15 --add-kernel=/boot/new-kernel.img \ --title='title' \ @@ -653,6 +654,41 @@ if [ "$testgrub2" == "y" ]; then --initrd=/boot/new-initrd \ --boot-filesystem= \ --copy-default + + ### /boot on LVMlv ### + testing="GRUB2 add kernel with boot on LVMlv" + grub2Test grub2.21 add/g2-1.21 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --boot-filesystem=/boot/ \ + --copy-default + + testing="GRUB2 add initrd with boot on LVMlv" + grub2Test grub2.22 add/g2-1.22 --update-kernel=/boot/new-kernel.img \ + --initrd=/boot/new-initrd --boot-filesystem=/boot/ + + testing="GRUB2 add kernel with rootfs on LVMlv and boot directory" + grub2Test grub2.23 add/g2-1.23 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --boot-filesystem= \ + --copy-default + + testing="GRUB2 add initrd with rootfs on LVMlv and boot directory" + grub2Test grub2.24 add/g2-1.24 --update-kernel=/boot/new-kernel.img \ + --initrd=/boot/new-initrd --boot-filesystem= + + testing="GRUB2 add kernel and initrd with boot on LVMlv" + grub2Test grub2.25 add/g2-1.25 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --initrd=/boot/new-initrd \ + --boot-filesystem=/boot/ \ + --copy-default + + testing="GRUB2 add kernel and initrd with rootfs on LVMlv and boot directory" + grub2Test grub2.26 add/g2-1.26 --add-kernel=/boot/new-kernel.img \ + --title='title' \ + --initrd=/boot/new-initrd \ + --boot-filesystem= \ + --copy-default fi fi
--- test/grub2.21 | 128 +++++++++++++++++++++++++++++++++++++++++ test/grub2.22 | 143 ++++++++++++++++++++++++++++++++++++++++++++++ test/grub2.23 | 128 +++++++++++++++++++++++++++++++++++++++++ test/grub2.24 | 143 ++++++++++++++++++++++++++++++++++++++++++++++ test/grub2.25 | 128 +++++++++++++++++++++++++++++++++++++++++ test/grub2.26 | 128 +++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.21 | 143 ++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.22 | 144 +++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.23 | 143 ++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.24 | 144 +++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.25 | 144 +++++++++++++++++++++++++++++++++++++++++++++++ test/results/add/g2-1.26 | 144 +++++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 1660 insertions(+) create mode 100644 test/grub2.21 create mode 100644 test/grub2.22 create mode 100644 test/grub2.23 create mode 100644 test/grub2.24 create mode 100644 test/grub2.25 create mode 100644 test/grub2.26 create mode 100644 test/results/add/g2-1.21 create mode 100644 test/results/add/g2-1.22 create mode 100644 test/results/add/g2-1.23 create mode 100644 test/results/add/g2-1.24 create mode 100644 test/results/add/g2-1.25 create mode 100644 test/results/add/g2-1.26
diff --git a/test/grub2.21 b/test/grub2.21 new file mode 100644 index 0000000..befc72b --- /dev/null +++ b/test/grub2.21 @@ -0,0 +1,128 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-2f4efce3149d46a68d3d8509c94f66b8' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-0-rescue-2f4efce3149d46a68d3d8509c94f66b8 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /initramfs-0-rescue-2f4efce3149d46a68d3d8509c94f66b8.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.22 b/test/grub2.22 new file mode 100644 index 0000000..d70b56e --- /dev/null +++ b/test/grub2.22 @@ -0,0 +1,143 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /new-kernel.img root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-2f4efce3149d46a68d3d8509c94f66b8' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-0-rescue-2f4efce3149d46a68d3d8509c94f66b8 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /initramfs-0-rescue-2f4efce3149d46a68d3d8509c94f66b8.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.23 b/test/grub2.23 new file mode 100644 index 0000000..6837616 --- /dev/null +++ b/test/grub2.23 @@ -0,0 +1,128 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-d67dbddcff294570b5eafbf3e88a2016' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-0-rescue-d67dbddcff294570b5eafbf3e88a2016 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /boot/initramfs-0-rescue-d67dbddcff294570b5eafbf3e88a2016.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.24 b/test/grub2.24 new file mode 100644 index 0000000..dc27a02 --- /dev/null +++ b/test/grub2.24 @@ -0,0 +1,143 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/new-kernel.img root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-d67dbddcff294570b5eafbf3e88a2016' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-0-rescue-d67dbddcff294570b5eafbf3e88a2016 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /boot/initramfs-0-rescue-d67dbddcff294570b5eafbf3e88a2016.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.25 b/test/grub2.25 new file mode 100644 index 0000000..befc72b --- /dev/null +++ b/test/grub2.25 @@ -0,0 +1,128 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-2f4efce3149d46a68d3d8509c94f66b8' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-0-rescue-2f4efce3149d46a68d3d8509c94f66b8 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /initramfs-0-rescue-2f4efce3149d46a68d3d8509c94f66b8.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/grub2.26 b/test/grub2.26 new file mode 100644 index 0000000..6837616 --- /dev/null +++ b/test/grub2.26 @@ -0,0 +1,128 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-d67dbddcff294570b5eafbf3e88a2016' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-0-rescue-d67dbddcff294570b5eafbf3e88a2016 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /boot/initramfs-0-rescue-d67dbddcff294570b5eafbf3e88a2016.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.21 b/test/results/add/g2-1.21 new file mode 100644 index 0000000..d70b56e --- /dev/null +++ b/test/results/add/g2-1.21 @@ -0,0 +1,143 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /new-kernel.img root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-2f4efce3149d46a68d3d8509c94f66b8' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-0-rescue-2f4efce3149d46a68d3d8509c94f66b8 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /initramfs-0-rescue-2f4efce3149d46a68d3d8509c94f66b8.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.22 b/test/results/add/g2-1.22 new file mode 100644 index 0000000..3dcc357 --- /dev/null +++ b/test/results/add/g2-1.22 @@ -0,0 +1,144 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /new-kernel.img root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-2f4efce3149d46a68d3d8509c94f66b8' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-0-rescue-2f4efce3149d46a68d3d8509c94f66b8 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /initramfs-0-rescue-2f4efce3149d46a68d3d8509c94f66b8.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.23 b/test/results/add/g2-1.23 new file mode 100644 index 0000000..dc27a02 --- /dev/null +++ b/test/results/add/g2-1.23 @@ -0,0 +1,143 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/new-kernel.img root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-d67dbddcff294570b5eafbf3e88a2016' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-0-rescue-d67dbddcff294570b5eafbf3e88a2016 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /boot/initramfs-0-rescue-d67dbddcff294570b5eafbf3e88a2016.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.24 b/test/results/add/g2-1.24 new file mode 100644 index 0000000..a2d913c --- /dev/null +++ b/test/results/add/g2-1.24 @@ -0,0 +1,144 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/new-kernel.img root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-d67dbddcff294570b5eafbf3e88a2016' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-0-rescue-d67dbddcff294570b5eafbf3e88a2016 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /boot/initramfs-0-rescue-d67dbddcff294570b5eafbf3e88a2016.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.25 b/test/results/add/g2-1.25 new file mode 100644 index 0000000..3dcc357 --- /dev/null +++ b/test/results/add/g2-1.25 @@ -0,0 +1,144 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /new-kernel.img root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-2f4efce3149d46a68d3d8509c94f66b8' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/goTm1A-IC4q-9lSU-NpW7-cl7v-Gmdu-00E0om/jC9IxZ-qehG-5NGd-M2Bs-YMN7-3Z1i-pOM35w' 7f51bdcd-d509-4416-9591-934f29a0486e + else + search --no-floppy --fs-uuid --set=root 7f51bdcd-d509-4416-9591-934f29a0486e + fi + linux16 /vmlinuz-0-rescue-2f4efce3149d46a68d3d8509c94f66b8 root=UUID=c63d50b3-c84a-493e-b3df-f3970258beff ro rd.lvm.lv=lvm1a/boot1 rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /initramfs-0-rescue-2f4efce3149d46a68d3d8509c94f66b8.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/test/results/add/g2-1.26 b/test/results/add/g2-1.26 new file mode 100644 index 0000000..a2d913c --- /dev/null +++ b/test/results/add/g2-1.26 @@ -0,0 +1,144 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +if [ x$feature_timeout_style = xy ] ; then + set timeout_style=menu + set timeout=15 +# Fallback normal timeout code in case the timeout_style feature is +# unavailable. +else + set timeout=15 +fi +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'title' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/new-kernel.img root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/new-initrd +} +menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet LANG=en_US.UTF-8 + initrd16 /boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img +} +menuentry 'Fedora, with Linux 0-rescue-d67dbddcff294570b5eafbf3e88a2016' --class gnu-linux --class gnu --class os { + load_video + insmod gzio + insmod part_msdos + insmod lvm + insmod ext2 + set root='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='lvmid/hSZ2kJ-qeBw-vsNO-eHS4-mIVg-ZQ8u-GLdIey/W1Ra9J-v0Nc-QlJl-9du4-2Itx-xxme-wneBeM' 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + else + search --no-floppy --fs-uuid --set=root 28ffbdd8-917b-4d55-93cc-8679dec6d6f1 + fi + linux16 /boot/vmlinuz-0-rescue-d67dbddcff294570b5eafbf3e88a2016 root=UUID=28ffbdd8-917b-4d55-93cc-8679dec6d6f1 ro rd.lvm.lv=lvm1a/swap rd.lvm.lv=lvm1a/root psmouse.proto=imps rhgb quiet + initrd16 /boot/initramfs-0-rescue-d67dbddcff294570b5eafbf3e88a2016.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### + +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ###
Arrgh ... murphy strikes ... [not you Chris but the legendary murphy of "murphy's law"]
So, everything works. The new regression tests run correctly when I do "make test" in my git clone repository as well as when I manually create an rpm with "rpmbuild -ba".
So, everything is OK. NOPE! I get regression test errors for three btrfs tests when (and only when) I build an rpm under mock.
The problem is that findBootPrefix() is a bit of a hack and does not work properly under mock chroot. Solution, another small hack which does work and still lets grubby operate correctly when doing a real kernel install.
Updated set of patches "real soon now" [I want to keep these together since it is likely that will be applied together]
Gene
On 06/28/2014 01:12 PM, Gene Czarcinski wrote:
The actual startup for Fedora 21 is rapidly approaching and I would like to see grubby updated in rawhide sooner rather than later so that the full testing process can be used to reveal any "undesirable features."
The version of anaconda installer in rawhide has been updated to support /boot on both btrfs and an LVMlv.
The primary objective of this update is to add support for /boot on btrfs. However, it also includes some related updates with respect to LVMlv support and the basic operation of grubby. Rather than having one giant update, this has been broken up into 8 patch files which (hopefully) will be easier to understand.
- Add code to limit the scan of a grub2 configuration file for a valid template to that to the main menu section.
- Add support for /boot on btrfs subvol or <dir> under rootrf on btrfs subvol.
- Add compile-time enabled debugging for btrfs support
- Add tests for btrfs support
- Add new run-time option to disable output from compile-time enabling of DEBUG.
- Enable DEBUG (for now a good idea but can be disabled once there is confidence in new updates) ... perhaps DEBUG should always be enabled and a new runtime parameter enables output. For now it is what it is.
- Similar to the regression tests for BTRFS support, add regression tests for /boot on LVMlv support.
- The test files to support #7.
Gene Czarcinski (8): v2 add code to validate a grub2 entry v2.2 add support for btrfs when grub2 is bootloader v2.1 add compile-time enabled debugging code for btrfs v2.1 add tests for btrfs support add disable-debug runtime option Enable DEBUG regression test to verify that boot on LVMlv supported files for LVMlv regressions tests
grubby.c | 312 +++++++++++++++++++++++++++++++++++++++++++---- test.sh | 78 +++++++++++- test/grub2.15 | 126 +++++++++++++++++++ test/grub2.16 | 140 +++++++++++++++++++++ test/grub2.17 | 128 +++++++++++++++++++ test/grub2.18 | 143 ++++++++++++++++++++++ test/grub2.19 | 126 +++++++++++++++++++ test/grub2.20 | 128 +++++++++++++++++++ test/grub2.21 | 128 +++++++++++++++++++ test/grub2.22 | 143 ++++++++++++++++++++++ test/grub2.23 | 128 +++++++++++++++++++ test/grub2.24 | 143 ++++++++++++++++++++++ test/grub2.25 | 128 +++++++++++++++++++ test/grub2.26 | 128 +++++++++++++++++++ test/results/add/g2-1.15 | 140 +++++++++++++++++++++ test/results/add/g2-1.16 | 141 +++++++++++++++++++++ test/results/add/g2-1.17 | 143 ++++++++++++++++++++++ test/results/add/g2-1.18 | 144 ++++++++++++++++++++++ test/results/add/g2-1.19 | 141 +++++++++++++++++++++ test/results/add/g2-1.20 | 144 ++++++++++++++++++++++ test/results/add/g2-1.21 | 143 ++++++++++++++++++++++ test/results/add/g2-1.22 | 144 ++++++++++++++++++++++ test/results/add/g2-1.23 | 143 ++++++++++++++++++++++ test/results/add/g2-1.24 | 144 ++++++++++++++++++++++ test/results/add/g2-1.25 | 144 ++++++++++++++++++++++ test/results/add/g2-1.26 | 144 ++++++++++++++++++++++ test/results/debug/g2.1 | 2 +- 27 files changed, 3669 insertions(+), 27 deletions(-) create mode 100644 test/grub2.15 create mode 100644 test/grub2.16 create mode 100644 test/grub2.17 create mode 100644 test/grub2.18 create mode 100644 test/grub2.19 create mode 100644 test/grub2.20 create mode 100644 test/grub2.21 create mode 100644 test/grub2.22 create mode 100644 test/grub2.23 create mode 100644 test/grub2.24 create mode 100644 test/grub2.25 create mode 100644 test/grub2.26 create mode 100644 test/results/add/g2-1.15 create mode 100644 test/results/add/g2-1.16 create mode 100644 test/results/add/g2-1.17 create mode 100644 test/results/add/g2-1.18 create mode 100644 test/results/add/g2-1.19 create mode 100644 test/results/add/g2-1.20 create mode 100644 test/results/add/g2-1.21 create mode 100644 test/results/add/g2-1.22 create mode 100644 test/results/add/g2-1.23 create mode 100644 test/results/add/g2-1.24 create mode 100644 test/results/add/g2-1.25 create mode 100644 test/results/add/g2-1.26
anaconda-devel@lists.stg.fedoraproject.org