diff --git a/0001-Change-return-type-in-getRootSpecifier.patch b/0001-Change-return-type-in-getRootSpecifier.patch deleted file mode 100644 index 0a6808b..0000000 --- a/0001-Change-return-type-in-getRootSpecifier.patch +++ /dev/null @@ -1,143 +0,0 @@ -From c1c46d21182974181f5b4c2ed0a02288b4bfd880 Mon Sep 17 00:00:00 2001 -From: Nathaniel McCallum -Date: Fri, 2 Mar 2018 14:59:32 -0500 -Subject: [PATCH 1/3] Change return type in getRootSpecifier() - -Rather than returning a new allocation of the prefix, just return the -length of the prefix. This change accomplishes a couple things. First, -it reduces some memory leaks since the return value was often never -freed. Second, it simplifies the caller who is usually only interested -in the length of the prefix. ---- - grubby.c | 54 +++++++++++++++++++++++++++--------------------------- - 1 file changed, 27 insertions(+), 27 deletions(-) - -diff --git a/grubby.c b/grubby.c -index d4ebb86..a062ef8 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -675,7 +675,7 @@ static int lineWrite(FILE * out, struct singleLine * line, - struct configFileInfo * cfi); - static int getNextLine(char ** bufPtr, struct singleLine * line, - struct configFileInfo * cfi); --static char * getRootSpecifier(char * str); -+static size_t getRootSpecifier(const char *str); - static void requote(struct singleLine *line, struct configFileInfo * cfi); - static void insertElement(struct singleLine * line, - const char * item, int insertHere, -@@ -1840,7 +1840,7 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, - char * fullName; - int i; - char * dev; -- char * rootspec; -+ size_t rs; - char * rootdev; - - if (skipRemoved && entry->skip) { -@@ -1866,12 +1866,11 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, - - fullName = alloca(strlen(bootPrefix) + - strlen(line->elements[1].item) + 1); -- rootspec = getRootSpecifier(line->elements[1].item); -- int rootspec_offset = rootspec ? strlen(rootspec) : 0; -+ rs = getRootSpecifier(line->elements[1].item); - int hasslash = endswith(bootPrefix, '/') || -- beginswith(line->elements[1].item + rootspec_offset, '/'); -+ beginswith(line->elements[1].item + rs, '/'); - sprintf(fullName, "%s%s%s", bootPrefix, hasslash ? "" : "/", -- line->elements[1].item + rootspec_offset); -+ line->elements[1].item + rs); - if (access(fullName, R_OK)) { - notSuitablePrintf(entry, 0, "access to %s failed\n", fullName); - return 0; -@@ -1952,7 +1951,6 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, - struct singleLine * line; - int i; - char * chptr; -- char * rootspec = NULL; - enum lineType_e checkType = LT_KERNEL; - - if (isdigit(*kernel)) { -@@ -2044,11 +2042,10 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, - - if (line && line->type != LT_MENUENTRY && - line->numElements >= 2) { -- rootspec = getRootSpecifier(line->elements[1].item); -- if (!strcmp(line->elements[1].item + -- ((rootspec != NULL) ? strlen(rootspec) : 0), -- kernel + strlen(prefix))) -- break; -+ if (!strcmp(line->elements[1].item + -+ getRootSpecifier(line->elements[1].item), -+ kernel + strlen(prefix))) -+ break; - } - if(line->type == LT_MENUENTRY && - !strcmp(line->elements[1].item, kernel)) -@@ -2797,11 +2794,11 @@ 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) { -- free(newLine->elements[1].item); -- newLine->elements[1].item = -- sdupprintf("%s%s", rootspec, val); -+ size_t rs = getRootSpecifier(tmplLine->elements[1].item); -+ if (rs > 0) { -+ free(newLine->elements[1].item); -+ newLine->elements[1].item = sdupprintf("%.*s%s", (int) rs, -+ tmplLine->elements[1].item, val); - } - } - } -@@ -3729,15 +3726,19 @@ int checkForElilo(struct grubConfig * config) { - return 1; - } - --static char * getRootSpecifier(char * str) { -- char * idx, * rootspec = NULL; -+static size_t getRootSpecifier(const char *str) -+{ -+ size_t rs = 0; - - if (*str == '(') { -- idx = rootspec = strdup(str); -- while(*idx && (*idx != ')') && (!isspace(*idx))) idx++; -- *(++idx) = '\0'; -+ for (; str[rs] != ')' && !isspace(str[rs]); rs++) { -+ if (!str[rs]) -+ return rs; -+ } -+ rs++; - } -- return rootspec; -+ -+ return rs; - } - - static char * getInitrdVal(struct grubConfig * config, -@@ -4616,7 +4617,7 @@ int main(int argc, const char ** argv) { - if (displayDefault) { - struct singleLine * line; - struct singleEntry * entry; -- char * rootspec; -+ size_t rs; - - if (config->defaultImage == -1) return 0; - if (config->defaultImage == DEFAULT_SAVED_GRUB2 && -@@ -4629,9 +4630,8 @@ int main(int argc, const char ** argv) { - line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!line) return 0; - -- rootspec = getRootSpecifier(line->elements[1].item); -- printf("%s%s\n", bootPrefix, line->elements[1].item + -- ((rootspec != NULL) ? strlen(rootspec) : 0)); -+ rs = getRootSpecifier(line->elements[1].item); -+ printf("%s%s\n", bootPrefix, line->elements[1].item + rs); - - return 0; - --- -2.14.3 - diff --git a/0001-remove-the-old-crufty-u-boot-support.patch b/0001-remove-the-old-crufty-u-boot-support.patch new file mode 100644 index 0000000..f6f5e97 --- /dev/null +++ b/0001-remove-the-old-crufty-u-boot-support.patch @@ -0,0 +1,235 @@ +From aa4472dbc10f3d669e24ac07293d7ac19e606866 Mon Sep 17 00:00:00 2001 +From: Dennis Gilmore +Date: Wed, 30 Aug 2017 14:03:45 -0500 +Subject: [PATCH 1/8] remove the old crufty u-boot support + +Fedora has only supported extlinux.conf for a few releases now +as a result it should be the only way we boot systems. Remove +the no longer needed uboot file + +Signed-off-by: Dennis Gilmore +--- + new-kernel-pkg | 116 ------------------------------------------------- + uboot | 43 ------------------ + 2 files changed, 159 deletions(-) + delete mode 100644 uboot + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index b634388a83f..962008e3c9d 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -37,7 +37,6 @@ else + fi + + [ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel +-[ -f /etc/sysconfig/uboot ] && . /etc/sysconfig/uboot + + cfgGrub2="" + cfgGrub2Efi="" +@@ -50,7 +49,6 @@ grubConfig="" + grub2Config="" + grub2EfiConfig="" + extlinuxConfig="" +-ubootScript="/boot/boot.scr" + + ARCH=$(uname -m) + +@@ -84,13 +82,6 @@ elif [[ ${ARCH} =~ armv[5|7].*l ]] ; then + liloConfig="" + bootPrefix=/boot + extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null) +- ubootDir=${UBOOT_DIR:-"/boot"} +- ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} +- ubootKList=${UBOOT_KLIST:-"klist.txt"} +- ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} +- ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"} +- ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"} +- ubootAddress=${UBOOT_IMGADDR:-"0x00008000"} + mounted="" + liloFlag="" + isx86="" +@@ -382,53 +373,6 @@ remove() { + [ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" + fi + +- if [ -n "$cfguBoot" ]; then +- [ -n "$verbose" ] && echo "removing $version from $ubootDir..." +- +- if [ -f $ubootDir/$ubootKList ]; then +- tmpKList=`mktemp $ubootDir/$ubootKList.XXXX` +- curversion=`tail -n1 $ubootDir/$ubootKList` +- sed "/$version$/d" $ubootDir/$ubootKList > $tmpKList +- newversion=`tail -n1 $tmpKList` +- if [ -f $ubootDir/uImage-$newversion ] && [ -f $ubootDir/uInitrd-$newversion ]; then +- if [ "$curversion" != "$newversion" ]; then +- cp -fp $ubootDir/uImage-$newversion $ubootDir/${ubootDefaultImage} +- if [ $? -ne 0 ]; then +- [ -n "$verbose" ] && echo "copy uImage-$newversion error, default kernel not replaced!" && exit +- fi +- cp -fp $ubootDir/uInitrd-$newversion $ubootDir/${ubootDefaultInitrd} +- if [ $? -ne 0 ]; then +- [ -n "$verbose" ] && echo "copy uInitrd-$newversion error, default Initrd not replaced!" && exit +- fi +- fi +- +- [ -n "$verbose" ] && echo "removing uImage-$version" +- if [ -f $ubootDir/uImage-$version ]; then +- rm -f $ubootDir/uImage-$version +- else +- [ -n "$verbose" ] && echo "uImage-$version did not exist!" +- fi +- +- [ -n "$verbose" ] && echo "removing uInitrd-$version" +- if [ -f $ubootDir/uInitrd-$version ]; then +- rm -f $ubootDir/uInitrd-$version +- else +- [ -n "$verbose" ] && echo "uInitrd-$version did not exist!" +- fi +- +- mv $tmpKList $ubootDir/$ubootKList +- [ -x /sbin/a-b-c ] && /sbin/a-b-c +- else +- [ -n "$verbose" ] && echo "uImage $newversion does not exist!" +- [ -f $tmpKList ] && rm -f $tmpKList +- fi +- else +- [ -n "$verbose" ] && echo "No previous kernel version. U-Boot images not removed!" +- fi +- else +- [ -n "$verbose" ] && echo "$ubootScript does not exist, not modifying $ubootDir" +- fi +- + if [ -n "$cfgExtlinux" ]; then + [ -n "$verbose" ] && echo "removing $version from $extlinuxConfig" + $grubby --extlinux -c $extlinuxConfig \ +@@ -530,36 +474,6 @@ update() { + [ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" + fi + +- if [ -n "$cfguBoot" ]; then +- [ -n "$verbose" ] && echo "adding $version to $ubootDir..." +- +- [ -n "$verbose" ] && echo "creating uImage-$version" +- mkimage -A arm -O linux -T kernel -C none -a $ubootAddress \ +- -e $ubootAddress -n $version \ +- -d $kernelImage $ubootDir/uImage-$version +- +- [ -n "$verbose" ] && echo "creating uInitrd-$version" +- mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \ +- -n initramfs -d $initrdfile $ubootDir/uInitrd-$version +- +- if [ -f $ubootDir/uImage-$version ] && [ -f $ubootDir/uInitrd-$version ]; then +- cp -fp $ubootDir/uImage-$version $ubootDir/${ubootDefaultImage} +- if [ $? -ne 0 ]; then +- [ -n "$verbose" ] && echo "copy uImage-$version error, kernel not installed!" && exit +- fi +- cp -fp $ubootDir/uInitrd-$version $ubootDir/${ubootDefaultInitrd} +- if [ $? -ne 0 ]; then +- [ -n "$verbose" ] && echo "copy uInitrd-$version error, kernel not installed!" && exit +- fi +- echo $version >> $ubootDir/$ubootKList +- [ -x /sbin/a-b-c ] && /sbin/a-b-c +- else +- [ -n "$verbose" ] && echo "cannot make $version the default" +- fi +- else +- [ -n "$verbose" ] && echo "$ubootScript does not exist, not setting up $ubootDir" +- fi +- + if [ -n "$cfgExtlinux" ]; then + [ -n "$verbose" ] && echo "updating $version from $extlinuxConfig" + ARGS="--extlinux -c $extlinuxConfig --update-kernel=$kernelImage \ +@@ -877,33 +791,6 @@ fi + [ -n "$liloConfig" ] && [ -f "$liloConfig" ] && cfgLilo=1; + [ -n "$extlinuxConfig" ] && [ -f "$extlinuxConfig" ] && cfgExtlinux=1; + +-# if we have a U-Boot directory, but no boot script, check if the directory +-# is mounted. If not, mount it, and then check if a boot script exists. +-if [ -n "$ubootDir" ]; then +- if [ -f "$ubootScript" ]; then +- cfguBoot=1 +- else +- mountEntry=`mount | grep $ubootDir` +- if [ -z "$mountEntry" ]; then +- mount $ubootDevice $ubootDir +- mounted=1 +- fi +- [ -f "$ubootScript" ] && cfguBoot=1; +- fi +-fi +- +-# if we're using U-Boot, check if the default load address should change +-if [ -n "$cfguBoot" -a -z "$UBOOT_IMGADDR" ]; then +- [[ $version =~ .([^.]*)$ ]] +- platform=${BASH_REMATCH[1]} +- # A few platforms use an alternate kernel load address +- if [ "$platform" = "omap" ]; then +- ubootAddress=0x80008000 +- elif [ "$platform" = "imx" ]; then +- ubootAddress=0x90008000 +- fi +-fi +- + # if we have a lilo config on an x86 box, see if the default boot loader + # is lilo to determine if it should be run + if [ -n "$cfgLilo" -a -n "$isx86" ]; then +@@ -920,7 +807,4 @@ elif [ "$mode" == "--rpmposttrans" ]; then + rpmposttrans + fi + +-# if we mounted the U-Boot directory, unmount it. +-[ -n "$mounted" ] && umount $ubootDir +- + exit 0 +diff --git a/uboot b/uboot +deleted file mode 100644 +index 07d8671822f..00000000000 +--- a/uboot ++++ /dev/null +@@ -1,43 +0,0 @@ +-# Settings for uBoot setup in /sbin/new-kernel-pkg +-# +-# Default values are provided below (as comments) +-# +-# WARNING: These values affect where grubby installs and removes +-# uBoot kernel images. Changing these _after_ kernels have +-# been installed may cause removing a kernel image to fail. +- +-# directory where uBoot images and scripts are found +-#UBOOT_DIR=/boot +- +-# Override the load address when running mkimage on the kernel. +-# OMAP such as Beagleboard and Pandaboard: Use 0x80008000 +-# Tegra such as Trimslice: Use 0x00008000 +-# IMX such as Efika mx51 smarttop: Use 0x90008000 +-# Kirkwood such as Dreamplug, Guruplug, Sheevaplug: Use 0x00008000 +-# If left undefined grubby will use defults for Tegra or OMAP depending +-# upon the contents of /proc/cpuinfo. +-#UBOOT_IMGADDR=0x0x00008000 +- +-# name of the text file containing the list of installed kernel versions +-# NOTE: The versions are in order of installation. The last entry should +-# always be the default boot kernel version. +-#UBOOT_KLIST=klist.txt +- +-# device partition where uBoot images reside; mounted on $UBOOT_DIR +-#UBOOT_DEVICE=mmcblk0p1 +- +- +-# NOTE: Both of the following files are automatically overwritte +-# when a kernel package is installed or removed. +- +-# default kernel uImage file name +-#UBOOT_UIMAGE=uImage +- +-# default initrd uInitrd file name +-#UBOOT_UINITRD=uInitrd +- +-# defualt for platform shipping an onboard dtb. +-#SHIPSDTB=no +- +-# option to tell new-kernel-pkg a specific dtb file to load in extlinux.conf +-#dtbfile=foo.dtb +-- +2.17.1 + diff --git a/0002-Add-btrfs-subvolume-support-for-grub2.patch b/0002-Add-btrfs-subvolume-support-for-grub2.patch deleted file mode 100644 index d460c5d..0000000 --- a/0002-Add-btrfs-subvolume-support-for-grub2.patch +++ /dev/null @@ -1,209 +0,0 @@ -From 5dec033b19bb5b07a0a136a7357e16c8ca9f5dd6 Mon Sep 17 00:00:00 2001 -From: Nathaniel McCallum -Date: Fri, 2 Mar 2018 08:40:18 -0500 -Subject: [PATCH 2/3] Add btrfs subvolume support for grub2 - -In order to find the subvolume prefix from a given path, we parse -/proc/mounts. In cases where /proc/mounts doesn't contain the -filesystem, the caller can use the --mounts option to specify his own -mounts file. - -Btrfs subvolumes are already supported by grub2 and by grub2-mkconfig. - -Fixes #22 ---- - grubby.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 143 insertions(+), 5 deletions(-) - -diff --git a/grubby.c b/grubby.c -index a062ef8..96d252a 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -68,6 +68,8 @@ int isEfi = 0; - - char *saved_command_line = NULL; - -+const char *mounts = "/proc/mounts"; -+ - /* comments get lumped in with indention */ - struct lineElement { - char * item; -@@ -1834,6 +1836,129 @@ static int endswith(const char *s, char c) - return s[slen] == c; - } - -+typedef struct { -+ const char *start; -+ size_t chars; -+} field; -+ -+static int iscomma(int c) -+{ -+ return c == ','; -+} -+ -+static int isequal(int c) -+{ -+ return c == '='; -+} -+ -+static field findField(const field *in, typeof(isspace) *isdelim, field *out) -+{ -+ field nxt = {}; -+ size_t off = 0; -+ -+ while (off < in->chars && isdelim(in->start[off])) -+ off++; -+ -+ if (off == in->chars) -+ return nxt; -+ -+ out->start = &in->start[off]; -+ out->chars = 0; -+ -+ while (off + out->chars < in->chars && !isdelim(out->start[out->chars])) -+ out->chars++; -+ -+ nxt.start = out->start + out->chars; -+ nxt.chars = in->chars - off - out->chars; -+ return nxt; -+} -+ -+static int fieldEquals(const field *in, const char *str) -+{ -+ return in->chars == strlen(str) && -+ strncmp(in->start, str, in->chars) == 0; -+} -+ -+/* Parse /proc/mounts to determine the subvolume prefix. */ -+static size_t subvolPrefix(const char *str) -+{ -+ FILE *file = NULL; -+ char *line = NULL; -+ size_t prfx = 0; -+ size_t size = 0; -+ -+ file = fopen(mounts, "r"); -+ if (!file) -+ return 0; -+ -+ for (ssize_t s; (s = getline(&line, &size, file)) >= 0; ) { -+ field nxt = { line, s }; -+ field dev = {}; -+ field path = {}; -+ field type = {}; -+ field opts = {}; -+ field opt = {}; -+ -+ nxt = findField(&nxt, isspace, &dev); -+ if (!nxt.start) -+ continue; -+ -+ nxt = findField(&nxt, isspace, &path); -+ if (!nxt.start) -+ continue; -+ -+ nxt = findField(&nxt, isspace, &type); -+ if (!nxt.start) -+ continue; -+ -+ nxt = findField(&nxt, isspace, &opts); -+ if (!nxt.start) -+ continue; -+ -+ if (!fieldEquals(&type, "btrfs")) -+ continue; -+ -+ /* We have found a btrfs mount point. */ -+ -+ nxt = opts; -+ while ((nxt = findField(&nxt, iscomma, &opt)).start) { -+ field key = {}; -+ field val = {}; -+ -+ opt = findField(&opt, isequal, &key); -+ if (!opt.start) -+ continue; -+ -+ opt = findField(&opt, isequal, &val); -+ if (!opt.start) -+ continue; -+ -+ if (!fieldEquals(&key, "subvol")) -+ continue; -+ -+ /* We have found a btrfs subvolume mount point. */ -+ -+ if (strncmp(val.start, str, val.chars)) -+ continue; -+ -+ if (val.start[val.chars - 1] != '/' && -+ str[val.chars] != '/') -+ continue; -+ -+ /* The subvolume mount point matches our input. */ -+ -+ if (prfx < val.chars) -+ prfx = val.chars; -+ } -+ } -+ -+ dbgPrintf("%s(): str: '%s', prfx: '%s'\n", __FUNCTION__, str, prfx); -+ -+ fclose(file); -+ free(line); -+ return prfx; -+} -+ - int suitableImage(struct singleEntry * entry, const char * bootPrefix, - int skipRemoved, int flags) { - struct singleLine * line; -@@ -2794,12 +2919,22 @@ 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)) { -- size_t rs = getRootSpecifier(tmplLine->elements[1].item); -+ const char *prfx = tmplLine->elements[1].item; -+ size_t rs = getRootSpecifier(prfx); -+ if (isinitrd(tmplLine->type)) { -+ for (struct singleLine *l = entry->lines; -+ rs == 0 && l; l = l->next) { -+ if (iskernel(l->type)) { -+ prfx = l->elements[1].item; -+ rs = getRootSpecifier(prfx); -+ } -+ } -+ } - if (rs > 0) { - free(newLine->elements[1].item); -- newLine->elements[1].item = sdupprintf("%.*s%s", (int) rs, -- tmplLine->elements[1].item, val); -- } -+ newLine->elements[1].item = sdupprintf("%.*s%s", -+ (int) rs, prfx, val); -+ } - } - } - -@@ -3738,7 +3873,7 @@ static size_t getRootSpecifier(const char *str) - rs++; - } - -- return rs; -+ return rs + subvolPrefix(str + rs); - } - - static char * getInitrdVal(struct grubConfig * config, -@@ -4253,6 +4388,9 @@ int main(int argc, const char ** argv) { - { "mbargs", 0, POPT_ARG_STRING, &newMBKernelArgs, 0, - _("default arguments for the new multiboot kernel or " - "new arguments for multiboot kernel being updated"), NULL }, -+ { "mounts", 0, POPT_ARG_STRING, &mounts, 0, -+ _("path to fake /proc/mounts file (for testing only)"), -+ _("mounts") }, - { "bad-image-okay", 0, 0, &badImageOkay, 0, - _("don't sanity check images in boot entries (for testing only)"), - NULL }, --- -2.14.3 - diff --git a/0002-Change-return-type-in-getRootSpecifier.patch b/0002-Change-return-type-in-getRootSpecifier.patch new file mode 100644 index 0000000..f2a1978 --- /dev/null +++ b/0002-Change-return-type-in-getRootSpecifier.patch @@ -0,0 +1,143 @@ +From 3afc4c0ed28d443bb71956b07fd45c8cfb07566f Mon Sep 17 00:00:00 2001 +From: Nathaniel McCallum +Date: Fri, 2 Mar 2018 14:59:32 -0500 +Subject: [PATCH 2/8] Change return type in getRootSpecifier() + +Rather than returning a new allocation of the prefix, just return the +length of the prefix. This change accomplishes a couple things. First, +it reduces some memory leaks since the return value was often never +freed. Second, it simplifies the caller who is usually only interested +in the length of the prefix. +--- + grubby.c | 54 +++++++++++++++++++++++++++--------------------------- + 1 file changed, 27 insertions(+), 27 deletions(-) + +diff --git a/grubby.c b/grubby.c +index d4ebb86168d..a062ef8e567 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -675,7 +675,7 @@ static int lineWrite(FILE * out, struct singleLine * line, + struct configFileInfo * cfi); + static int getNextLine(char ** bufPtr, struct singleLine * line, + struct configFileInfo * cfi); +-static char * getRootSpecifier(char * str); ++static size_t getRootSpecifier(const char *str); + static void requote(struct singleLine *line, struct configFileInfo * cfi); + static void insertElement(struct singleLine * line, + const char * item, int insertHere, +@@ -1840,7 +1840,7 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, + char * fullName; + int i; + char * dev; +- char * rootspec; ++ size_t rs; + char * rootdev; + + if (skipRemoved && entry->skip) { +@@ -1866,12 +1866,11 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, + + fullName = alloca(strlen(bootPrefix) + + strlen(line->elements[1].item) + 1); +- rootspec = getRootSpecifier(line->elements[1].item); +- int rootspec_offset = rootspec ? strlen(rootspec) : 0; ++ rs = getRootSpecifier(line->elements[1].item); + int hasslash = endswith(bootPrefix, '/') || +- beginswith(line->elements[1].item + rootspec_offset, '/'); ++ beginswith(line->elements[1].item + rs, '/'); + sprintf(fullName, "%s%s%s", bootPrefix, hasslash ? "" : "/", +- line->elements[1].item + rootspec_offset); ++ line->elements[1].item + rs); + if (access(fullName, R_OK)) { + notSuitablePrintf(entry, 0, "access to %s failed\n", fullName); + return 0; +@@ -1952,7 +1951,6 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, + struct singleLine * line; + int i; + char * chptr; +- char * rootspec = NULL; + enum lineType_e checkType = LT_KERNEL; + + if (isdigit(*kernel)) { +@@ -2044,11 +2042,10 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, + + if (line && line->type != LT_MENUENTRY && + line->numElements >= 2) { +- rootspec = getRootSpecifier(line->elements[1].item); +- if (!strcmp(line->elements[1].item + +- ((rootspec != NULL) ? strlen(rootspec) : 0), +- kernel + strlen(prefix))) +- break; ++ if (!strcmp(line->elements[1].item + ++ getRootSpecifier(line->elements[1].item), ++ kernel + strlen(prefix))) ++ break; + } + if(line->type == LT_MENUENTRY && + !strcmp(line->elements[1].item, kernel)) +@@ -2797,11 +2794,11 @@ 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) { +- free(newLine->elements[1].item); +- newLine->elements[1].item = +- sdupprintf("%s%s", rootspec, val); ++ size_t rs = getRootSpecifier(tmplLine->elements[1].item); ++ if (rs > 0) { ++ free(newLine->elements[1].item); ++ newLine->elements[1].item = sdupprintf("%.*s%s", (int) rs, ++ tmplLine->elements[1].item, val); + } + } + } +@@ -3729,15 +3726,19 @@ int checkForElilo(struct grubConfig * config) { + return 1; + } + +-static char * getRootSpecifier(char * str) { +- char * idx, * rootspec = NULL; ++static size_t getRootSpecifier(const char *str) ++{ ++ size_t rs = 0; + + if (*str == '(') { +- idx = rootspec = strdup(str); +- while(*idx && (*idx != ')') && (!isspace(*idx))) idx++; +- *(++idx) = '\0'; ++ for (; str[rs] != ')' && !isspace(str[rs]); rs++) { ++ if (!str[rs]) ++ return rs; ++ } ++ rs++; + } +- return rootspec; ++ ++ return rs; + } + + static char * getInitrdVal(struct grubConfig * config, +@@ -4616,7 +4617,7 @@ int main(int argc, const char ** argv) { + if (displayDefault) { + struct singleLine * line; + struct singleEntry * entry; +- char * rootspec; ++ size_t rs; + + if (config->defaultImage == -1) return 0; + if (config->defaultImage == DEFAULT_SAVED_GRUB2 && +@@ -4629,9 +4630,8 @@ int main(int argc, const char ** argv) { + line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!line) return 0; + +- rootspec = getRootSpecifier(line->elements[1].item); +- printf("%s%s\n", bootPrefix, line->elements[1].item + +- ((rootspec != NULL) ? strlen(rootspec) : 0)); ++ rs = getRootSpecifier(line->elements[1].item); ++ printf("%s%s\n", bootPrefix, line->elements[1].item + rs); + + return 0; + +-- +2.17.1 + diff --git a/0003-Add-btrfs-subvolume-support-for-grub2.patch b/0003-Add-btrfs-subvolume-support-for-grub2.patch new file mode 100644 index 0000000..583c5de --- /dev/null +++ b/0003-Add-btrfs-subvolume-support-for-grub2.patch @@ -0,0 +1,209 @@ +From 112b6e5fc690b2a73b6ad8c92dc4645db08503b6 Mon Sep 17 00:00:00 2001 +From: Nathaniel McCallum +Date: Fri, 2 Mar 2018 08:40:18 -0500 +Subject: [PATCH 3/8] Add btrfs subvolume support for grub2 + +In order to find the subvolume prefix from a given path, we parse +/proc/mounts. In cases where /proc/mounts doesn't contain the +filesystem, the caller can use the --mounts option to specify his own +mounts file. + +Btrfs subvolumes are already supported by grub2 and by grub2-mkconfig. + +Fixes #22 +--- + grubby.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 143 insertions(+), 5 deletions(-) + +diff --git a/grubby.c b/grubby.c +index a062ef8e567..96d252a0a83 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -68,6 +68,8 @@ int isEfi = 0; + + char *saved_command_line = NULL; + ++const char *mounts = "/proc/mounts"; ++ + /* comments get lumped in with indention */ + struct lineElement { + char * item; +@@ -1834,6 +1836,129 @@ static int endswith(const char *s, char c) + return s[slen] == c; + } + ++typedef struct { ++ const char *start; ++ size_t chars; ++} field; ++ ++static int iscomma(int c) ++{ ++ return c == ','; ++} ++ ++static int isequal(int c) ++{ ++ return c == '='; ++} ++ ++static field findField(const field *in, typeof(isspace) *isdelim, field *out) ++{ ++ field nxt = {}; ++ size_t off = 0; ++ ++ while (off < in->chars && isdelim(in->start[off])) ++ off++; ++ ++ if (off == in->chars) ++ return nxt; ++ ++ out->start = &in->start[off]; ++ out->chars = 0; ++ ++ while (off + out->chars < in->chars && !isdelim(out->start[out->chars])) ++ out->chars++; ++ ++ nxt.start = out->start + out->chars; ++ nxt.chars = in->chars - off - out->chars; ++ return nxt; ++} ++ ++static int fieldEquals(const field *in, const char *str) ++{ ++ return in->chars == strlen(str) && ++ strncmp(in->start, str, in->chars) == 0; ++} ++ ++/* Parse /proc/mounts to determine the subvolume prefix. */ ++static size_t subvolPrefix(const char *str) ++{ ++ FILE *file = NULL; ++ char *line = NULL; ++ size_t prfx = 0; ++ size_t size = 0; ++ ++ file = fopen(mounts, "r"); ++ if (!file) ++ return 0; ++ ++ for (ssize_t s; (s = getline(&line, &size, file)) >= 0; ) { ++ field nxt = { line, s }; ++ field dev = {}; ++ field path = {}; ++ field type = {}; ++ field opts = {}; ++ field opt = {}; ++ ++ nxt = findField(&nxt, isspace, &dev); ++ if (!nxt.start) ++ continue; ++ ++ nxt = findField(&nxt, isspace, &path); ++ if (!nxt.start) ++ continue; ++ ++ nxt = findField(&nxt, isspace, &type); ++ if (!nxt.start) ++ continue; ++ ++ nxt = findField(&nxt, isspace, &opts); ++ if (!nxt.start) ++ continue; ++ ++ if (!fieldEquals(&type, "btrfs")) ++ continue; ++ ++ /* We have found a btrfs mount point. */ ++ ++ nxt = opts; ++ while ((nxt = findField(&nxt, iscomma, &opt)).start) { ++ field key = {}; ++ field val = {}; ++ ++ opt = findField(&opt, isequal, &key); ++ if (!opt.start) ++ continue; ++ ++ opt = findField(&opt, isequal, &val); ++ if (!opt.start) ++ continue; ++ ++ if (!fieldEquals(&key, "subvol")) ++ continue; ++ ++ /* We have found a btrfs subvolume mount point. */ ++ ++ if (strncmp(val.start, str, val.chars)) ++ continue; ++ ++ if (val.start[val.chars - 1] != '/' && ++ str[val.chars] != '/') ++ continue; ++ ++ /* The subvolume mount point matches our input. */ ++ ++ if (prfx < val.chars) ++ prfx = val.chars; ++ } ++ } ++ ++ dbgPrintf("%s(): str: '%s', prfx: '%s'\n", __FUNCTION__, str, prfx); ++ ++ fclose(file); ++ free(line); ++ return prfx; ++} ++ + int suitableImage(struct singleEntry * entry, const char * bootPrefix, + int skipRemoved, int flags) { + struct singleLine * line; +@@ -2794,12 +2919,22 @@ 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)) { +- size_t rs = getRootSpecifier(tmplLine->elements[1].item); ++ const char *prfx = tmplLine->elements[1].item; ++ size_t rs = getRootSpecifier(prfx); ++ if (isinitrd(tmplLine->type)) { ++ for (struct singleLine *l = entry->lines; ++ rs == 0 && l; l = l->next) { ++ if (iskernel(l->type)) { ++ prfx = l->elements[1].item; ++ rs = getRootSpecifier(prfx); ++ } ++ } ++ } + if (rs > 0) { + free(newLine->elements[1].item); +- newLine->elements[1].item = sdupprintf("%.*s%s", (int) rs, +- tmplLine->elements[1].item, val); +- } ++ newLine->elements[1].item = sdupprintf("%.*s%s", ++ (int) rs, prfx, val); ++ } + } + } + +@@ -3738,7 +3873,7 @@ static size_t getRootSpecifier(const char *str) + rs++; + } + +- return rs; ++ return rs + subvolPrefix(str + rs); + } + + static char * getInitrdVal(struct grubConfig * config, +@@ -4253,6 +4388,9 @@ int main(int argc, const char ** argv) { + { "mbargs", 0, POPT_ARG_STRING, &newMBKernelArgs, 0, + _("default arguments for the new multiboot kernel or " + "new arguments for multiboot kernel being updated"), NULL }, ++ { "mounts", 0, POPT_ARG_STRING, &mounts, 0, ++ _("path to fake /proc/mounts file (for testing only)"), ++ _("mounts") }, + { "bad-image-okay", 0, 0, &badImageOkay, 0, + _("don't sanity check images in boot entries (for testing only)"), + NULL }, +-- +2.17.1 + diff --git a/0003-Add-tests-for-btrfs-support.patch b/0003-Add-tests-for-btrfs-support.patch deleted file mode 100644 index d274bb9..0000000 --- a/0003-Add-tests-for-btrfs-support.patch +++ /dev/null @@ -1,1871 +0,0 @@ -From 20d92194d03750d5d839c501d0539f9258614aae Mon Sep 17 00:00:00 2001 -From: Gene Czarcinski -Date: Mon, 9 Jun 2014 21:11:37 -0400 -Subject: [PATCH 3/3] Add tests for btrfs support - -The tests performed are: -- add kernel with /boot on btrfs subvol (20) -- update kernel/add initrd with /boot on btrfs subvol (21) -- add kernel with rootfs on btrfs subvol and /boot a directory (22) -- update kernel/add initrd with rootfs on btrfs subvol and - /boot a directory (23) -- add kernel and initrd with /boot on btrfs subvol (24) -- add kernel and initrd with rootfs on btrfs subvol and /boot - a directory (25) ---- - test.sh | 40 ++++++++++ - test/grub2-support_files/g2.20-mounts | 2 + - test/grub2-support_files/g2.21-mounts | 1 + - test/grub2-support_files/g2.22-mounts | 1 + - test/grub2-support_files/g2.23-mounts | 1 + - test/grub2-support_files/g2.24-mounts | 1 + - test/grub2-support_files/g2.25-mounts | 1 + - test/grub2.20 | 126 +++++++++++++++++++++++++++++ - test/grub2.21 | 140 +++++++++++++++++++++++++++++++++ - test/grub2.22 | 128 ++++++++++++++++++++++++++++++ - test/grub2.23 | 143 +++++++++++++++++++++++++++++++++ - test/grub2.24 | 126 +++++++++++++++++++++++++++++ - test/grub2.25 | 128 ++++++++++++++++++++++++++++++ - test/results/add/g2-1.20 | 140 +++++++++++++++++++++++++++++++++ - test/results/add/g2-1.21 | 141 +++++++++++++++++++++++++++++++++ - test/results/add/g2-1.22 | 143 +++++++++++++++++++++++++++++++++ - test/results/add/g2-1.23 | 144 ++++++++++++++++++++++++++++++++++ - test/results/add/g2-1.24 | 141 +++++++++++++++++++++++++++++++++ - test/results/add/g2-1.25 | 144 ++++++++++++++++++++++++++++++++++ - 19 files changed, 1691 insertions(+) - create mode 100644 test/grub2-support_files/g2.20-mounts - create mode 120000 test/grub2-support_files/g2.21-mounts - create mode 100644 test/grub2-support_files/g2.22-mounts - create mode 120000 test/grub2-support_files/g2.23-mounts - create mode 120000 test/grub2-support_files/g2.24-mounts - create mode 120000 test/grub2-support_files/g2.25-mounts - 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/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 - -diff --git a/test.sh b/test.sh -index 6379698..c35bfca 100755 ---- a/test.sh -+++ b/test.sh -@@ -629,6 +629,46 @@ if [ "$testgrub2" == "y" ]; then - --initrd /boot/initramfs-0-rescue-5a94251776a14678911d4ae0949500f5.img \ - --copy-default --title "Fedora 21 Rescue" --args=root=/fooooo \ - --remove-kernel=wtf --boot-filesystem=/boot/ -+ -+ testing="GRUB2 add kernel with boot on btrfs subvol" -+ grub2Test grub2.20 add/g2-1.20 --add-kernel=/boot/new-kernel.img \ -+ --title='title' \ -+ --boot-filesystem=/boot/ \ -+ --copy-default \ -+ --mounts='test/grub2-support_files/g2.20-mounts' -+ -+ testing="GRUB2 add initrd with boot on btrfs subvol" -+ grub2Test grub2.21 add/g2-1.21 --update-kernel=/boot/new-kernel.img \ -+ --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ -+ --mounts='test/grub2-support_files/g2.21-mounts' -+ -+ testing="GRUB2 add kernel with rootfs on btrfs subvol and boot directory" -+ grub2Test grub2.22 add/g2-1.22 --add-kernel=/boot/new-kernel.img \ -+ --title='title' \ -+ --boot-filesystem= \ -+ --copy-default \ -+ --mounts='test/grub2-support_files/g2.22-mounts' -+ -+ testing="GRUB2 add initrd with rootfs on btrfs subvol and boot directory" -+ grub2Test grub2.23 add/g2-1.23 --update-kernel=/boot/new-kernel.img \ -+ --initrd=/boot/new-initrd --boot-filesystem= \ -+ --mounts='test/grub2-support_files/g2.23-mounts' -+ -+ testing="GRUB2 add kernel and initrd with boot on btrfs subvol" -+ grub2Test grub2.24 add/g2-1.24 --add-kernel=/boot/new-kernel.img \ -+ --title='title' \ -+ --initrd=/boot/new-initrd \ -+ --boot-filesystem=/boot/ \ -+ --copy-default \ -+ --mounts='test/grub2-support_files/g2.24-mounts' -+ -+ testing="GRUB2 add kernel and initrd with rootfs on btrfs subvol and boot directory" -+ grub2Test grub2.25 add/g2-1.25 --add-kernel=/boot/new-kernel.img \ -+ --title='title' \ -+ --initrd=/boot/new-initrd \ -+ --boot-filesystem= \ -+ --copy-default \ -+ --mounts='test/grub2-support_files/g2.25-mounts' - fi - fi - -diff --git a/test/grub2-support_files/g2.20-mounts b/test/grub2-support_files/g2.20-mounts -new file mode 100644 -index 0000000..00bdb48 ---- /dev/null -+++ b/test/grub2-support_files/g2.20-mounts -@@ -0,0 +1,2 @@ -+/dev/sda / btrfs subvol=/root6,defaults 0 0 -+/dev/sda /boot btrfs subvol=/boot6,defaults 0 0 -diff --git a/test/grub2-support_files/g2.21-mounts b/test/grub2-support_files/g2.21-mounts -new file mode 120000 -index 0000000..42ef3fd ---- /dev/null -+++ b/test/grub2-support_files/g2.21-mounts -@@ -0,0 +1 @@ -+g2.20-mounts -\ No newline at end of file -diff --git a/test/grub2-support_files/g2.22-mounts b/test/grub2-support_files/g2.22-mounts -new file mode 100644 -index 0000000..5b664e7 ---- /dev/null -+++ b/test/grub2-support_files/g2.22-mounts -@@ -0,0 +1 @@ -+/dev/sda / btrfs defaults,subvol=/root4,ro 0 0 -diff --git a/test/grub2-support_files/g2.23-mounts b/test/grub2-support_files/g2.23-mounts -new file mode 120000 -index 0000000..74f036f ---- /dev/null -+++ b/test/grub2-support_files/g2.23-mounts -@@ -0,0 +1 @@ -+g2.22-mounts -\ No newline at end of file -diff --git a/test/grub2-support_files/g2.24-mounts b/test/grub2-support_files/g2.24-mounts -new file mode 120000 -index 0000000..42ef3fd ---- /dev/null -+++ b/test/grub2-support_files/g2.24-mounts -@@ -0,0 +1 @@ -+g2.20-mounts -\ No newline at end of file -diff --git a/test/grub2-support_files/g2.25-mounts b/test/grub2-support_files/g2.25-mounts -new file mode 120000 -index 0000000..74f036f ---- /dev/null -+++ b/test/grub2-support_files/g2.25-mounts -@@ -0,0 +1 @@ -+g2.22-mounts -\ No newline at end of file -diff --git a/test/grub2.20 b/test/grub2.20 -new file mode 100644 -index 0000000..23b75fa ---- /dev/null -+++ b/test/grub2.20 -@@ -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.21 b/test/grub2.21 -new file mode 100644 -index 0000000..579c2f6 ---- /dev/null -+++ b/test/grub2.21 -@@ -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.22 b/test/grub2.22 -new file mode 100644 -index 0000000..9466bc3 ---- /dev/null -+++ b/test/grub2.22 -@@ -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.23 b/test/grub2.23 -new file mode 100644 -index 0000000..5cb240f ---- /dev/null -+++ b/test/grub2.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 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.24 b/test/grub2.24 -new file mode 100644 -index 0000000..23b75fa ---- /dev/null -+++ b/test/grub2.24 -@@ -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.25 b/test/grub2.25 -new file mode 100644 -index 0000000..9466bc3 ---- /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 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.20 b/test/results/add/g2-1.20 -new file mode 100644 -index 0000000..579c2f6 ---- /dev/null -+++ b/test/results/add/g2-1.20 -@@ -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.21 b/test/results/add/g2-1.21 -new file mode 100644 -index 0000000..c0dded9 ---- /dev/null -+++ b/test/results/add/g2-1.21 -@@ -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.22 b/test/results/add/g2-1.22 -new file mode 100644 -index 0000000..5cb240f ---- /dev/null -+++ b/test/results/add/g2-1.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 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.23 b/test/results/add/g2-1.23 -new file mode 100644 -index 0000000..c3e87cf ---- /dev/null -+++ b/test/results/add/g2-1.23 -@@ -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.24 b/test/results/add/g2-1.24 -new file mode 100644 -index 0000000..c0dded9 ---- /dev/null -+++ b/test/results/add/g2-1.24 -@@ -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.25 b/test/results/add/g2-1.25 -new file mode 100644 -index 0000000..c3e87cf ---- /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 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 ### --- -2.14.3 - diff --git a/0004-Add-tests-for-btrfs-support.patch b/0004-Add-tests-for-btrfs-support.patch new file mode 100644 index 0000000..f4b8ec8 --- /dev/null +++ b/0004-Add-tests-for-btrfs-support.patch @@ -0,0 +1,1871 @@ +From e319f73ca691b9cc138def3a9c19f1cb6e581475 Mon Sep 17 00:00:00 2001 +From: Gene Czarcinski +Date: Mon, 9 Jun 2014 21:11:37 -0400 +Subject: [PATCH 4/8] Add tests for btrfs support + +The tests performed are: +- add kernel with /boot on btrfs subvol (20) +- update kernel/add initrd with /boot on btrfs subvol (21) +- add kernel with rootfs on btrfs subvol and /boot a directory (22) +- update kernel/add initrd with rootfs on btrfs subvol and + /boot a directory (23) +- add kernel and initrd with /boot on btrfs subvol (24) +- add kernel and initrd with rootfs on btrfs subvol and /boot + a directory (25) +--- + test.sh | 40 +++++++ + test/grub2-support_files/g2.20-mounts | 2 + + test/grub2-support_files/g2.21-mounts | 1 + + test/grub2-support_files/g2.22-mounts | 1 + + test/grub2-support_files/g2.23-mounts | 1 + + test/grub2-support_files/g2.24-mounts | 1 + + test/grub2-support_files/g2.25-mounts | 1 + + test/grub2.20 | 126 ++++++++++++++++++++++ + test/grub2.21 | 140 +++++++++++++++++++++++++ + test/grub2.22 | 128 +++++++++++++++++++++++ + test/grub2.23 | 143 +++++++++++++++++++++++++ + test/grub2.24 | 126 ++++++++++++++++++++++ + test/grub2.25 | 128 +++++++++++++++++++++++ + test/results/add/g2-1.20 | 140 +++++++++++++++++++++++++ + test/results/add/g2-1.21 | 141 +++++++++++++++++++++++++ + test/results/add/g2-1.22 | 143 +++++++++++++++++++++++++ + test/results/add/g2-1.23 | 144 ++++++++++++++++++++++++++ + test/results/add/g2-1.24 | 141 +++++++++++++++++++++++++ + test/results/add/g2-1.25 | 144 ++++++++++++++++++++++++++ + 19 files changed, 1691 insertions(+) + create mode 100644 test/grub2-support_files/g2.20-mounts + create mode 120000 test/grub2-support_files/g2.21-mounts + create mode 100644 test/grub2-support_files/g2.22-mounts + create mode 120000 test/grub2-support_files/g2.23-mounts + create mode 120000 test/grub2-support_files/g2.24-mounts + create mode 120000 test/grub2-support_files/g2.25-mounts + 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/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 + +diff --git a/test.sh b/test.sh +index 6379698c6de..c35bfca1c89 100755 +--- a/test.sh ++++ b/test.sh +@@ -629,6 +629,46 @@ if [ "$testgrub2" == "y" ]; then + --initrd /boot/initramfs-0-rescue-5a94251776a14678911d4ae0949500f5.img \ + --copy-default --title "Fedora 21 Rescue" --args=root=/fooooo \ + --remove-kernel=wtf --boot-filesystem=/boot/ ++ ++ testing="GRUB2 add kernel with boot on btrfs subvol" ++ grub2Test grub2.20 add/g2-1.20 --add-kernel=/boot/new-kernel.img \ ++ --title='title' \ ++ --boot-filesystem=/boot/ \ ++ --copy-default \ ++ --mounts='test/grub2-support_files/g2.20-mounts' ++ ++ testing="GRUB2 add initrd with boot on btrfs subvol" ++ grub2Test grub2.21 add/g2-1.21 --update-kernel=/boot/new-kernel.img \ ++ --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ ++ --mounts='test/grub2-support_files/g2.21-mounts' ++ ++ testing="GRUB2 add kernel with rootfs on btrfs subvol and boot directory" ++ grub2Test grub2.22 add/g2-1.22 --add-kernel=/boot/new-kernel.img \ ++ --title='title' \ ++ --boot-filesystem= \ ++ --copy-default \ ++ --mounts='test/grub2-support_files/g2.22-mounts' ++ ++ testing="GRUB2 add initrd with rootfs on btrfs subvol and boot directory" ++ grub2Test grub2.23 add/g2-1.23 --update-kernel=/boot/new-kernel.img \ ++ --initrd=/boot/new-initrd --boot-filesystem= \ ++ --mounts='test/grub2-support_files/g2.23-mounts' ++ ++ testing="GRUB2 add kernel and initrd with boot on btrfs subvol" ++ grub2Test grub2.24 add/g2-1.24 --add-kernel=/boot/new-kernel.img \ ++ --title='title' \ ++ --initrd=/boot/new-initrd \ ++ --boot-filesystem=/boot/ \ ++ --copy-default \ ++ --mounts='test/grub2-support_files/g2.24-mounts' ++ ++ testing="GRUB2 add kernel and initrd with rootfs on btrfs subvol and boot directory" ++ grub2Test grub2.25 add/g2-1.25 --add-kernel=/boot/new-kernel.img \ ++ --title='title' \ ++ --initrd=/boot/new-initrd \ ++ --boot-filesystem= \ ++ --copy-default \ ++ --mounts='test/grub2-support_files/g2.25-mounts' + fi + fi + +diff --git a/test/grub2-support_files/g2.20-mounts b/test/grub2-support_files/g2.20-mounts +new file mode 100644 +index 00000000000..00bdb48e4ab +--- /dev/null ++++ b/test/grub2-support_files/g2.20-mounts +@@ -0,0 +1,2 @@ ++/dev/sda / btrfs subvol=/root6,defaults 0 0 ++/dev/sda /boot btrfs subvol=/boot6,defaults 0 0 +diff --git a/test/grub2-support_files/g2.21-mounts b/test/grub2-support_files/g2.21-mounts +new file mode 120000 +index 00000000000..42ef3fd4272 +--- /dev/null ++++ b/test/grub2-support_files/g2.21-mounts +@@ -0,0 +1 @@ ++g2.20-mounts +\ No newline at end of file +diff --git a/test/grub2-support_files/g2.22-mounts b/test/grub2-support_files/g2.22-mounts +new file mode 100644 +index 00000000000..5b664e72519 +--- /dev/null ++++ b/test/grub2-support_files/g2.22-mounts +@@ -0,0 +1 @@ ++/dev/sda / btrfs defaults,subvol=/root4,ro 0 0 +diff --git a/test/grub2-support_files/g2.23-mounts b/test/grub2-support_files/g2.23-mounts +new file mode 120000 +index 00000000000..74f036fc4a3 +--- /dev/null ++++ b/test/grub2-support_files/g2.23-mounts +@@ -0,0 +1 @@ ++g2.22-mounts +\ No newline at end of file +diff --git a/test/grub2-support_files/g2.24-mounts b/test/grub2-support_files/g2.24-mounts +new file mode 120000 +index 00000000000..42ef3fd4272 +--- /dev/null ++++ b/test/grub2-support_files/g2.24-mounts +@@ -0,0 +1 @@ ++g2.20-mounts +\ No newline at end of file +diff --git a/test/grub2-support_files/g2.25-mounts b/test/grub2-support_files/g2.25-mounts +new file mode 120000 +index 00000000000..74f036fc4a3 +--- /dev/null ++++ b/test/grub2-support_files/g2.25-mounts +@@ -0,0 +1 @@ ++g2.22-mounts +\ No newline at end of file +diff --git a/test/grub2.20 b/test/grub2.20 +new file mode 100644 +index 00000000000..23b75fa8d3c +--- /dev/null ++++ b/test/grub2.20 +@@ -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.21 b/test/grub2.21 +new file mode 100644 +index 00000000000..579c2f6744a +--- /dev/null ++++ b/test/grub2.21 +@@ -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.22 b/test/grub2.22 +new file mode 100644 +index 00000000000..9466bc35153 +--- /dev/null ++++ b/test/grub2.22 +@@ -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.23 b/test/grub2.23 +new file mode 100644 +index 00000000000..5cb240fc1de +--- /dev/null ++++ b/test/grub2.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 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.24 b/test/grub2.24 +new file mode 100644 +index 00000000000..23b75fa8d3c +--- /dev/null ++++ b/test/grub2.24 +@@ -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.25 b/test/grub2.25 +new file mode 100644 +index 00000000000..9466bc35153 +--- /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 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.20 b/test/results/add/g2-1.20 +new file mode 100644 +index 00000000000..579c2f6744a +--- /dev/null ++++ b/test/results/add/g2-1.20 +@@ -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.21 b/test/results/add/g2-1.21 +new file mode 100644 +index 00000000000..c0dded9724c +--- /dev/null ++++ b/test/results/add/g2-1.21 +@@ -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.22 b/test/results/add/g2-1.22 +new file mode 100644 +index 00000000000..5cb240fc1de +--- /dev/null ++++ b/test/results/add/g2-1.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 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.23 b/test/results/add/g2-1.23 +new file mode 100644 +index 00000000000..c3e87cf7897 +--- /dev/null ++++ b/test/results/add/g2-1.23 +@@ -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.24 b/test/results/add/g2-1.24 +new file mode 100644 +index 00000000000..c0dded9724c +--- /dev/null ++++ b/test/results/add/g2-1.24 +@@ -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.25 b/test/results/add/g2-1.25 +new file mode 100644 +index 00000000000..c3e87cf7897 +--- /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 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 ### +-- +2.17.1 + diff --git a/0004-Honor-sbindir.patch b/0004-Honor-sbindir.patch deleted file mode 100644 index 5a2c5cf..0000000 --- a/0004-Honor-sbindir.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a56df998177574ef2db332220c15f11bccd98f7e Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 18 Jul 2018 13:41:02 -0400 -Subject: [PATCH] Honor sbindir - -Signed-off-by: Peter Jones ---- - Makefile | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index ac144046133..2b18dd6404b 100644 ---- a/Makefile -+++ b/Makefile -@@ -42,14 +42,14 @@ test: all - @./test.sh - - install: all -- mkdir -p $(DESTDIR)$(PREFIX)/sbin -+ mkdir -p $(DESTDIR)$(PREFIX)$(sbindir) - mkdir -p $(DESTDIR)/$(mandir)/man8 -- install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)/sbin -+ install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)$(sbindir) - install -m 644 new-kernel-pkg.8 $(DESTDIR)/$(mandir)/man8 -- install -m 755 installkernel $(DESTDIR)$(PREFIX)/sbin -+ install -m 755 installkernel $(DESTDIR)$(PREFIX)$(sbindir) - install -m 644 installkernel.8 $(DESTDIR)/$(mandir)/man8 - if [ -f grubby ]; then \ -- install -m 755 grubby $(DESTDIR)$(PREFIX)/sbin ; \ -+ install -m 755 grubby $(DESTDIR)$(PREFIX)$(sbindir) ; \ - install -m 644 grubby.8 $(DESTDIR)/$(mandir)/man8 ; \ - fi - --- -2.17.1 - diff --git a/0004-Use-system-LDFLAGS.patch b/0004-Use-system-LDFLAGS.patch deleted file mode 100644 index f186b98..0000000 --- a/0004-Use-system-LDFLAGS.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fbc4d4feef66df7224fde64adae95525e73bf141 Mon Sep 17 00:00:00 2001 -From: Rafael dos Santos -Date: Tue, 29 May 2018 15:15:24 +0200 -Subject: [PATCH] Use system LDFLAGS - ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index ac14404..f0d1372 100644 ---- a/Makefile -+++ b/Makefile -@@ -25,7 +25,7 @@ OBJECTS = grubby.o log.o - CC = gcc - RPM_OPT_FLAGS ?= -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector - CFLAGS += $(RPM_OPT_FLAGS) -std=gnu99 -Wall -Werror -Wno-error=unused-function -Wno-unused-function -ggdb --LDFLAGS := -+LDFLAGS := $(RPM_LD_FLAGS) - - grubby_LIBS = -lblkid -lpopt - --- -2.17.0 - diff --git a/0005-Use-system-LDFLAGS.patch b/0005-Use-system-LDFLAGS.patch new file mode 100644 index 0000000..17954c4 --- /dev/null +++ b/0005-Use-system-LDFLAGS.patch @@ -0,0 +1,25 @@ +From e08c858af4d2b09e62441560f3ccecc9e750c87a Mon Sep 17 00:00:00 2001 +From: Rafael dos Santos +Date: Tue, 29 May 2018 15:15:24 +0200 +Subject: [PATCH 5/8] Use system LDFLAGS + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index ac144046133..f0d13720db5 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,7 +25,7 @@ OBJECTS = grubby.o log.o + CC = gcc + RPM_OPT_FLAGS ?= -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector + CFLAGS += $(RPM_OPT_FLAGS) -std=gnu99 -Wall -Werror -Wno-error=unused-function -Wno-unused-function -ggdb +-LDFLAGS := ++LDFLAGS := $(RPM_LD_FLAGS) + + grubby_LIBS = -lblkid -lpopt + +-- +2.17.1 + diff --git a/0005-installkernel-use-kernel-install.patch b/0005-installkernel-use-kernel-install.patch deleted file mode 100644 index 2ec577d..0000000 --- a/0005-installkernel-use-kernel-install.patch +++ /dev/null @@ -1,48 +0,0 @@ -From f93a35be5bdec17044dd2a17980689d3cbf73d58 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 31 Jul 2018 17:43:53 +0200 -Subject: [PATCH] Make installkernel to use kernel-install scripts on BLS - configuration - -The kernel make install target executes the arch/$ARCH/boot/install.sh -that in turns executes the distro specific installkernel script. This -script always uses new-kernel-pkg to install the kernel images. - -But on a BootLoaderSpec setup, the kernel-install scripts must be used -instead. Check if the system uses a BLS setup, and call kernel-install -add in that case instead of new-kernel-pkg. - -Reported-by: Hans de Goede -Signed-off-by: Javier Martinez Canillas ---- - installkernel | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/installkernel b/installkernel -index b887929c179..68dcfac16d2 100755 ---- a/installkernel -+++ b/installkernel -@@ -20,6 +20,8 @@ - # Author(s): tyson@rwii.com - # - -+[[ -f /etc/default/grub ]] && . /etc/default/grub -+ - usage() { - echo "Usage: `basename $0` " >&2 - exit 1 -@@ -77,6 +79,11 @@ cp $MAPFILE $INSTALL_PATH/System.map-$KERNEL_VERSION - ln -fs ${RELATIVE_PATH}$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION $LINK_PATH/$KERNEL_NAME - ln -fs ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map - -+if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ] || [ ! -f /sbin/new-kernel-pkg ]; then -+ kernel-install add $KERNEL_VERSION $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION -+ exit $? -+fi -+ - if [ -n "$cfgLoader" ] && [ -x /sbin/new-kernel-pkg ]; then - if [ -n "$(which dracut 2>/dev/null)" ]; then - new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install --kernel-name $KERNEL_NAME $KERNEL_VERSION --- -2.17.1 - diff --git a/0006-Honor-sbindir.patch b/0006-Honor-sbindir.patch new file mode 100644 index 0000000..0d947cc --- /dev/null +++ b/0006-Honor-sbindir.patch @@ -0,0 +1,36 @@ +From db200499551e386e7616c621fcbd69e350081664 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 18 Jul 2018 13:41:02 -0400 +Subject: [PATCH 6/8] Honor sbindir + +Signed-off-by: Peter Jones +--- + Makefile | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index f0d13720db5..cfa8e0d60ab 100644 +--- a/Makefile ++++ b/Makefile +@@ -42,14 +42,14 @@ test: all + @./test.sh + + install: all +- mkdir -p $(DESTDIR)$(PREFIX)/sbin ++ mkdir -p $(DESTDIR)$(PREFIX)$(sbindir) + mkdir -p $(DESTDIR)/$(mandir)/man8 +- install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)/sbin ++ install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)$(sbindir) + install -m 644 new-kernel-pkg.8 $(DESTDIR)/$(mandir)/man8 +- install -m 755 installkernel $(DESTDIR)$(PREFIX)/sbin ++ install -m 755 installkernel $(DESTDIR)$(PREFIX)$(sbindir) + install -m 644 installkernel.8 $(DESTDIR)/$(mandir)/man8 + if [ -f grubby ]; then \ +- install -m 755 grubby $(DESTDIR)$(PREFIX)/sbin ; \ ++ install -m 755 grubby $(DESTDIR)$(PREFIX)$(sbindir) ; \ + install -m 644 grubby.8 $(DESTDIR)/$(mandir)/man8 ; \ + fi + +-- +2.17.1 + diff --git a/0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch b/0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch new file mode 100644 index 0000000..727cab6 --- /dev/null +++ b/0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch @@ -0,0 +1,48 @@ +From fa1bf7b54cb71fa193da16ffc404f8535d7d16ac Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 31 Jul 2018 17:43:53 +0200 +Subject: [PATCH 7/8] Make installkernel to use kernel-install scripts on BLS + configuration + +The kernel make install target executes the arch/$ARCH/boot/install.sh +that in turns executes the distro specific installkernel script. This +script always uses new-kernel-pkg to install the kernel images. + +But on a BootLoaderSpec setup, the kernel-install scripts must be used +instead. Check if the system uses a BLS setup, and call kernel-install +add in that case instead of new-kernel-pkg. + +Reported-by: Hans de Goede +Signed-off-by: Javier Martinez Canillas +--- + installkernel | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/installkernel b/installkernel +index b887929c179..68dcfac16d2 100755 +--- a/installkernel ++++ b/installkernel +@@ -20,6 +20,8 @@ + # Author(s): tyson@rwii.com + # + ++[[ -f /etc/default/grub ]] && . /etc/default/grub ++ + usage() { + echo "Usage: `basename $0` " >&2 + exit 1 +@@ -77,6 +79,11 @@ cp $MAPFILE $INSTALL_PATH/System.map-$KERNEL_VERSION + ln -fs ${RELATIVE_PATH}$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION $LINK_PATH/$KERNEL_NAME + ln -fs ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map + ++if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ] || [ ! -f /sbin/new-kernel-pkg ]; then ++ kernel-install add $KERNEL_VERSION $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION ++ exit $? ++fi ++ + if [ -n "$cfgLoader" ] && [ -x /sbin/new-kernel-pkg ]; then + if [ -n "$(which dracut 2>/dev/null)" ]; then + new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install --kernel-name $KERNEL_NAME $KERNEL_VERSION +-- +2.17.1 + diff --git a/drop-uboot-uImage-creation.patch b/drop-uboot-uImage-creation.patch deleted file mode 100644 index ee611f9..0000000 --- a/drop-uboot-uImage-creation.patch +++ /dev/null @@ -1,232 +0,0 @@ -From 3689d4cebedf115e41c192bf034b6f86fcb80acb Mon Sep 17 00:00:00 2001 -From: Dennis Gilmore -Date: Wed, 30 Aug 2017 14:03:45 -0500 -Subject: [PATCH] remove the old crufty u-boot support - -Fedora has only supported extlinux.conf for a few releases now -as a result it should be the only way we boot systems. Remove -the no longer needed uboot file - -Signed-off-by: Dennis Gilmore ---- - new-kernel-pkg | 116 --------------------------------------------------------- - uboot | 43 --------------------- - 2 files changed, 159 deletions(-) - delete mode 100644 uboot - -diff --git a/new-kernel-pkg b/new-kernel-pkg -index 64225de..0fe6caa 100755 ---- a/new-kernel-pkg -+++ b/new-kernel-pkg -@@ -37,7 +37,6 @@ else - fi - - [ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel --[ -f /etc/sysconfig/uboot ] && . /etc/sysconfig/uboot - - cfgGrub2="" - cfgGrub2Efi="" -@@ -50,7 +49,6 @@ grubConfig="" - grub2Config="" - grub2EfiConfig="" - extlinuxConfig="" --ubootScript="/boot/boot.scr" - - ARCH=$(uname -m) - -@@ -84,13 +82,6 @@ elif [[ ${ARCH} =~ armv[5|7].*l ]] ; then - liloConfig="" - bootPrefix=/boot - extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null) -- ubootDir=${UBOOT_DIR:-"/boot"} -- ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} -- ubootKList=${UBOOT_KLIST:-"klist.txt"} -- ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} -- ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"} -- ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"} -- ubootAddress=${UBOOT_IMGADDR:-"0x00008000"} - mounted="" - liloFlag="" - isx86="" -@@ -386,53 +377,6 @@ remove() { - [ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" - fi - -- if [ -n "$cfguBoot" ]; then -- [ -n "$verbose" ] && echo "removing $version from $ubootDir..." -- -- if [ -f $ubootDir/$ubootKList ]; then -- tmpKList=`mktemp $ubootDir/$ubootKList.XXXX` -- curversion=`tail -n1 $ubootDir/$ubootKList` -- sed "/$version$/d" $ubootDir/$ubootKList > $tmpKList -- newversion=`tail -n1 $tmpKList` -- if [ -f $ubootDir/uImage-$newversion ] && [ -f $ubootDir/uInitrd-$newversion ]; then -- if [ "$curversion" != "$newversion" ]; then -- cp -fp $ubootDir/uImage-$newversion $ubootDir/${ubootDefaultImage} -- if [ $? -ne 0 ]; then -- [ -n "$verbose" ] && echo "copy uImage-$newversion error, default kernel not replaced!" && exit -- fi -- cp -fp $ubootDir/uInitrd-$newversion $ubootDir/${ubootDefaultInitrd} -- if [ $? -ne 0 ]; then -- [ -n "$verbose" ] && echo "copy uInitrd-$newversion error, default Initrd not replaced!" && exit -- fi -- fi -- -- [ -n "$verbose" ] && echo "removing uImage-$version" -- if [ -f $ubootDir/uImage-$version ]; then -- rm -f $ubootDir/uImage-$version -- else -- [ -n "$verbose" ] && echo "uImage-$version did not exist!" -- fi -- -- [ -n "$verbose" ] && echo "removing uInitrd-$version" -- if [ -f $ubootDir/uInitrd-$version ]; then -- rm -f $ubootDir/uInitrd-$version -- else -- [ -n "$verbose" ] && echo "uInitrd-$version did not exist!" -- fi -- -- mv $tmpKList $ubootDir/$ubootKList -- [ -x /sbin/a-b-c ] && /sbin/a-b-c -- else -- [ -n "$verbose" ] && echo "uImage $newversion does not exist!" -- [ -f $tmpKList ] && rm -f $tmpKList -- fi -- else -- [ -n "$verbose" ] && echo "No previous kernel version. U-Boot images not removed!" -- fi -- else -- [ -n "$verbose" ] && echo "$ubootScript does not exist, not modifying $ubootDir" -- fi -- - if [ -n "$cfgExtlinux" ]; then - [ -n "$verbose" ] && echo "removing $version from $extlinuxConfig" - $grubby --extlinux -c $extlinuxConfig \ -@@ -534,36 +478,6 @@ update() { - [ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" - fi - -- if [ -n "$cfguBoot" ]; then -- [ -n "$verbose" ] && echo "adding $version to $ubootDir..." -- -- [ -n "$verbose" ] && echo "creating uImage-$version" -- mkimage -A arm -O linux -T kernel -C none -a $ubootAddress \ -- -e $ubootAddress -n $version \ -- -d $kernelImage $ubootDir/uImage-$version -- -- [ -n "$verbose" ] && echo "creating uInitrd-$version" -- mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \ -- -n initramfs -d $initrdfile $ubootDir/uInitrd-$version -- -- if [ -f $ubootDir/uImage-$version ] && [ -f $ubootDir/uInitrd-$version ]; then -- cp -fp $ubootDir/uImage-$version $ubootDir/${ubootDefaultImage} -- if [ $? -ne 0 ]; then -- [ -n "$verbose" ] && echo "copy uImage-$version error, kernel not installed!" && exit -- fi -- cp -fp $ubootDir/uInitrd-$version $ubootDir/${ubootDefaultInitrd} -- if [ $? -ne 0 ]; then -- [ -n "$verbose" ] && echo "copy uInitrd-$version error, kernel not installed!" && exit -- fi -- echo $version >> $ubootDir/$ubootKList -- [ -x /sbin/a-b-c ] && /sbin/a-b-c -- else -- [ -n "$verbose" ] && echo "cannot make $version the default" -- fi -- else -- [ -n "$verbose" ] && echo "$ubootScript does not exist, not setting up $ubootDir" -- fi -- - if [ -n "$cfgExtlinux" ]; then - [ -n "$verbose" ] && echo "updating $version from $extlinuxConfig" - ARGS="--extlinux -c $extlinuxConfig --update-kernel=$kernelImage \ -@@ -874,33 +788,6 @@ fi - [ -n "$liloConfig" ] && [ -f "$liloConfig" ] && cfgLilo=1; - [ -n "$extlinuxConfig" ] && [ -f "$extlinuxConfig" ] && cfgExtlinux=1; - --# if we have a U-Boot directory, but no boot script, check if the directory --# is mounted. If not, mount it, and then check if a boot script exists. --if [ -n "$ubootDir" ]; then -- if [ -f "$ubootScript" ]; then -- cfguBoot=1 -- else -- mountEntry=`mount | grep $ubootDir` -- if [ -z "$mountEntry" ]; then -- mount $ubootDevice $ubootDir -- mounted=1 -- fi -- [ -f "$ubootScript" ] && cfguBoot=1; -- fi --fi -- --# if we're using U-Boot, check if the default load address should change --if [ -n "$cfguBoot" -a -z "$UBOOT_IMGADDR" ]; then -- [[ $version =~ .([^.]*)$ ]] -- platform=${BASH_REMATCH[1]} -- # A few platforms use an alternate kernel load address -- if [ "$platform" = "omap" ]; then -- ubootAddress=0x80008000 -- elif [ "$platform" = "imx" ]; then -- ubootAddress=0x90008000 -- fi --fi -- - # if we have a lilo config on an x86 box, see if the default boot loader - # is lilo to determine if it should be run - if [ -n "$cfgLilo" -a -n "$isx86" ]; then -@@ -920,7 +807,4 @@ elif [ "$mode" == "--rpmposttrans" ]; then - rpmposttrans - fi - --# if we mounted the U-Boot directory, unmount it. --[ -n "$mounted" ] && umount $ubootDir -- - exit 0 -diff --git a/uboot b/uboot -deleted file mode 100644 -index 07d8671..0000000 ---- a/uboot -+++ /dev/null -@@ -1,43 +0,0 @@ --# Settings for uBoot setup in /sbin/new-kernel-pkg --# --# Default values are provided below (as comments) --# --# WARNING: These values affect where grubby installs and removes --# uBoot kernel images. Changing these _after_ kernels have --# been installed may cause removing a kernel image to fail. -- --# directory where uBoot images and scripts are found --#UBOOT_DIR=/boot -- --# Override the load address when running mkimage on the kernel. --# OMAP such as Beagleboard and Pandaboard: Use 0x80008000 --# Tegra such as Trimslice: Use 0x00008000 --# IMX such as Efika mx51 smarttop: Use 0x90008000 --# Kirkwood such as Dreamplug, Guruplug, Sheevaplug: Use 0x00008000 --# If left undefined grubby will use defults for Tegra or OMAP depending --# upon the contents of /proc/cpuinfo. --#UBOOT_IMGADDR=0x0x00008000 -- --# name of the text file containing the list of installed kernel versions --# NOTE: The versions are in order of installation. The last entry should --# always be the default boot kernel version. --#UBOOT_KLIST=klist.txt -- --# device partition where uBoot images reside; mounted on $UBOOT_DIR --#UBOOT_DEVICE=mmcblk0p1 -- -- --# NOTE: Both of the following files are automatically overwritte --# when a kernel package is installed or removed. -- --# default kernel uImage file name --#UBOOT_UIMAGE=uImage -- --# default initrd uInitrd file name --#UBOOT_UINITRD=uInitrd -- --# defualt for platform shipping an onboard dtb. --#SHIPSDTB=no -- --# option to tell new-kernel-pkg a specific dtb file to load in extlinux.conf --#dtbfile=foo.dtb diff --git a/grubby.spec b/grubby.spec index 927385f..9df4e4a 100644 --- a/grubby.spec +++ b/grubby.spec @@ -13,13 +13,13 @@ Source1: grubby-bls Source2: grubby.in Source3: installkernel.in Source4: installkernel-bls -Patch1: drop-uboot-uImage-creation.patch -Patch2: 0001-Change-return-type-in-getRootSpecifier.patch -Patch3: 0002-Add-btrfs-subvolume-support-for-grub2.patch -Patch4: 0003-Add-tests-for-btrfs-support.patch -Patch5: 0004-Use-system-LDFLAGS.patch -Patch6: 0004-Honor-sbindir.patch -Patch7: 0005-installkernel-use-kernel-install.patch +Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch +Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch +Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch +Patch0004: 0004-Add-tests-for-btrfs-support.patch +Patch0005: 0005-Use-system-LDFLAGS.patch +Patch0006: 0006-Honor-sbindir.patch +Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch BuildRequires: gcc BuildRequires: pkgconfig glib2-devel popt-devel