From 37c1d015a25095060b7e8e27365fa2767a402366 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sun, 18 Aug 2019 16:44:19 +0200 Subject: [PATCH] - updated to 2.04 --- add-vlan-tag-support.patch | 157 ---- blscfg.patch | 1438 +++++++++++++++++++++++++++++-- efi-net-fix.patch | 10 +- gcc8.patch | 36 - grub-garbage.patch | 10 +- grub-lvmdevice.patch | 10 +- grub-mkconfig-diagnostics.patch | 129 +-- grub2-cfg.patch | 8 +- grub2-fonts_path.patch | 10 +- grub2.spec | 24 +- ignore-kernel-symlinks.patch | 8 +- initrd-search.patch | 22 +- just-say-linux.patch | 16 +- posix.patch | 6 +- restricted.patch | 22 +- tld-mkconfigdir.patch | 16 +- tld-sysconfdir.patch | 22 +- 17 files changed, 1510 insertions(+), 434 deletions(-) delete mode 100644 add-vlan-tag-support.patch delete mode 100644 gcc8.patch diff --git a/add-vlan-tag-support.patch b/add-vlan-tag-support.patch deleted file mode 100644 index 42fde72..0000000 --- a/add-vlan-tag-support.patch +++ /dev/null @@ -1,157 +0,0 @@ -diff -urNp grub-2.02-rc1.orig/grub-core/kern/ieee1275/init.c grub-2.02-rc1/grub-core/kern/ieee1275/init.c ---- grub-2.02-rc1.orig/grub-core/kern/ieee1275/init.c 2017-02-08 15:06:05.420317447 +0000 -+++ grub-2.02-rc1/grub-core/kern/ieee1275/init.c 2017-02-08 15:06:17.784317308 +0000 -@@ -125,6 +125,7 @@ grub_machine_get_bootlocation (char **de - char *dev, *canon; - char *ptr; - dev = grub_ieee1275_get_aliasdevname (bootpath); -+ grub_ieee1275_parse_net_options (bootpath); - canon = grub_ieee1275_canonicalise_devname (dev); - ptr = canon + grub_strlen (canon) - 1; - while (ptr > canon && (*ptr == ',' || *ptr == ':')) -diff -urNp grub-2.02-rc1.orig/grub-core/kern/ieee1275/openfw.c grub-2.02-rc1/grub-core/kern/ieee1275/openfw.c ---- grub-2.02-rc1.orig/grub-core/kern/ieee1275/openfw.c 2017-02-08 15:06:05.420317447 +0000 -+++ grub-2.02-rc1/grub-core/kern/ieee1275/openfw.c 2017-02-08 15:06:17.785317308 +0000 -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - enum grub_ieee1275_parse_type - { -@@ -451,6 +452,35 @@ fail: - return ret; - } - -+int -+grub_ieee1275_parse_net_options (const char *path) -+{ -+ char *comma; -+ char *args; -+ char *option = 0; -+ -+ args = grub_ieee1275_get_devargs (path); -+ if (!args) -+ /* There is no option. */ -+ return -1; -+ -+ do -+ { -+ comma = grub_strchr (args, ','); -+ if (! comma) -+ option = grub_strdup (args); -+ else -+ option = grub_strndup (args, (grub_size_t)(comma - args)); -+ args = comma + 1; -+ -+ if (! grub_strncmp(option, "vtag", 4)) -+ grub_env_set ("vlan-tag", option + grub_strlen("vtag=")); -+ -+ } while (comma); -+ -+ return 0; -+} -+ - char * - grub_ieee1275_get_device_type (const char *path) - { -diff -urNp grub-2.02-rc1.orig/grub-core/net/ethernet.c grub-2.02-rc1/grub-core/net/ethernet.c ---- grub-2.02-rc1.orig/grub-core/net/ethernet.c 2017-02-08 15:06:05.433317447 +0000 -+++ grub-2.02-rc1/grub-core/net/ethernet.c 2017-02-08 15:06:17.785317308 +0000 -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_ne - { - struct etherhdr *eth; - grub_err_t err; -+ grub_uint32_t vlantag = 0; -+ grub_uint8_t etherhdr_size; - -- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE); -+ etherhdr_size = sizeof (*eth); -+ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE); - -- err = grub_netbuff_push (nb, sizeof (*eth)); -+ const char *vlantag_text = grub_env_get ("vlan-tag"); -+ if (vlantag_text != 0) { -+ etherhdr_size += 4; -+ vlantag = grub_strtoul (vlantag_text, 0, 16); -+ } -+ -+ err = grub_netbuff_push (nb, etherhdr_size); - if (err) - return err; - eth = (struct etherhdr *) nb->data; -@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_ne - return err; - inf->card->opened = 1; - } -+ -+ /* Check if a vlan-tag is needed. */ -+ if (vlantag != 0) -+ { -+ /* Move eth type to the right */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 2, -+ (char *) nb->data + etherhdr_size - 6, 2); -+ -+ /* Add the tag in the middle */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 6, -+ &vlantag, 4); -+ } -+ - return inf->card->driver->send (inf->card, nb); - } - -@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct gr - grub_net_link_level_address_t hwaddress; - grub_net_link_level_address_t src_hwaddress; - grub_err_t err; -+ grub_uint8_t etherhdr_size = sizeof (*eth); -+ -+ grub_uint16_t vlantag_identifier = 0; -+ grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2); -+ -+ /* Check if a vlan-tag is present. */ -+ if (vlantag_identifier == VLANTAG_IDENTIFIER) -+ { -+ etherhdr_size += 4; -+ /* Move eth type to the original position */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 6, -+ (char *) nb->data + etherhdr_size - 2, 2); -+ } - - eth = (struct etherhdr *) nb->data; - type = grub_be_to_cpu16 (eth->type); -- err = grub_netbuff_pull (nb, sizeof (*eth)); -+ err = grub_netbuff_pull (nb, etherhdr_size); - if (err) - return err; - -diff -urNp grub-2.02-rc1.orig/include/grub/ieee1275/ieee1275.h grub-2.02-rc1/include/grub/ieee1275/ieee1275.h ---- grub-2.02-rc1.orig/include/grub/ieee1275/ieee1275.h 2017-02-08 15:06:05.445317447 +0000 -+++ grub-2.02-rc1/include/grub/ieee1275/ieee1275.h 2017-02-08 15:06:17.787317308 +0000 -@@ -227,6 +227,7 @@ char *EXPORT_FUNC(grub_ieee1275_get_alia - char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path); - char *EXPORT_FUNC(grub_ieee1275_get_device_type) (const char *path); - char *EXPORT_FUNC(grub_ieee1275_get_devname) (const char *path); -+int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path); - - void EXPORT_FUNC(grub_ieee1275_devalias_init_iterator) (struct grub_ieee1275_devalias *alias); - void EXPORT_FUNC(grub_ieee1275_devalias_free) (struct grub_ieee1275_devalias *alias); -diff -urNp grub-2.02-rc1.orig/include/grub/net.h grub-2.02-rc1/include/grub/net.h ---- grub-2.02-rc1.orig/include/grub/net.h 2017-02-08 15:06:05.446317447 +0000 -+++ grub-2.02-rc1/include/grub/net.h 2017-02-08 15:06:17.788317308 +0000 -@@ -561,4 +561,6 @@ extern char *grub_net_default_server; - #define GRUB_NET_INTERVAL 400 - #define GRUB_NET_INTERVAL_ADDITION 20 - -+#define VLANTAG_IDENTIFIER 0x8100 -+ - #endif /* ! GRUB_NET_HEADER */ diff --git a/blscfg.patch b/blscfg.patch index 356661a..f25dd28 100644 --- a/blscfg.patch +++ b/blscfg.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/grub-core/commands/blscfg.c grub-2.02-rc1/grub-core/commands/blscfg.c ---- grub-2.02-rc1.orig/grub-core/commands/blscfg.c 1970-01-01 00:00:00.000000000 +0000 -+++ grub-2.02-rc1/grub-core/commands/blscfg.c 2017-02-08 15:09:21.548315239 +0000 -@@ -0,0 +1,201 @@ +diff -urN grub-2.04.orig/grub-core/commands/blscfg.c grub-2.04/grub-core/commands/blscfg.c +--- grub-2.04.orig/grub-core/commands/blscfg.c 1970-01-01 01:00:00.000000000 +0100 ++++ grub-2.04/grub-core/commands/blscfg.c 2019-08-18 16:14:44.723000000 +0200 +@@ -0,0 +1,1096 @@ +/*-*- Mode: C; c-basic-offset: 2; indent-tabs-mode: t -*-*/ + +/* bls.c - implementation of the boot loader spec */ @@ -23,6 +23,7 @@ diff -urNp grub-2.02-rc1.orig/grub-core/commands/blscfg.c grub-2.02-rc1/grub-cor + * along with GRUB. If not, see . + */ + ++#include +#include +#include +#include @@ -34,143 +35,936 @@ diff -urNp grub-2.02-rc1.orig/grub-core/commands/blscfg.c grub-2.02-rc1/grub-cor +#include +#include +#include ++#include ++ ++#include + +GRUB_MOD_LICENSE ("GPLv3+"); + -+#ifdef GRUB_MACHINE_EFI -+#define GRUB_LINUX_CMD "linuxefi" -+#define GRUB_INITRD_CMD "initrdefi" -+#define GRUB_BLS_CONFIG_PATH "/EFI/fedora/loader/entries/" -+#define GRUB_BOOT_DEVICE "($boot)" -+#else -+#define GRUB_LINUX_CMD "linux" -+#define GRUB_INITRD_CMD "initrd" ++#include "loadenv.h" ++ +#define GRUB_BLS_CONFIG_PATH "/loader/entries/" ++#ifdef GRUB_MACHINE_EMU ++#define GRUB_BOOT_DEVICE "/boot" ++#else +#define GRUB_BOOT_DEVICE "($root)" +#endif + -+static int parse_entry ( ++struct keyval ++{ ++ const char *key; ++ char *val; ++}; ++ ++static struct bls_entry *entries = NULL; ++ ++#define FOR_BLS_ENTRIES(var) FOR_LIST_ELEMENTS (var, entries) ++ ++static int bls_add_keyval(struct bls_entry *entry, char *key, char *val) ++{ ++ char *k, *v; ++ struct keyval **kvs, *kv; ++ int new_n = entry->nkeyvals + 1; ++ ++ kvs = grub_realloc (entry->keyvals, new_n * sizeof (struct keyval *)); ++ if (!kvs) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "couldn't find space for BLS entry"); ++ entry->keyvals = kvs; ++ ++ kv = grub_malloc (sizeof (struct keyval)); ++ if (!kv) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "couldn't find space for BLS entry"); ++ ++ k = grub_strdup (key); ++ if (!k) ++ { ++ grub_free (kv); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "couldn't find space for BLS entry"); ++ } ++ ++ v = grub_strdup (val); ++ if (!v) ++ { ++ grub_free (k); ++ grub_free (kv); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "couldn't find space for BLS entry"); ++ } ++ ++ kv->key = k; ++ kv->val = v; ++ ++ entry->keyvals[entry->nkeyvals] = kv; ++ grub_dprintf("blscfg", "new keyval at %p:%s:%s\n", entry->keyvals[entry->nkeyvals], k, v); ++ entry->nkeyvals = new_n; ++ ++ return 0; ++} ++ ++/* Find they value of the key named by keyname. If there are allowed to be ++ * more than one, pass a pointer to an int set to -1 the first time, and pass ++ * the same pointer through each time after, and it'll return them in sorted ++ * order as defined in the BLS fragment file */ ++static char *bls_get_val(struct bls_entry *entry, const char *keyname, int *last) ++{ ++ int idx, start = 0; ++ struct keyval *kv = NULL; ++ ++ if (last) ++ start = *last + 1; ++ ++ for (idx = start; idx < entry->nkeyvals; idx++) { ++ kv = entry->keyvals[idx]; ++ ++ if (!grub_strcmp (keyname, kv->key)) ++ break; ++ } ++ ++ if (idx == entry->nkeyvals) { ++ if (last) ++ *last = -1; ++ return NULL; ++ } ++ ++ if (last) ++ *last = idx; ++ ++ return kv->val; ++} ++ ++#define goto_return(x) ({ ret = (x); goto finish; }) ++ ++/* compare alpha and numeric segments of two versions */ ++/* return 1: a is newer than b */ ++/* 0: a and b are the same version */ ++/* -1: b is newer than a */ ++static int vercmp(const char * a, const char * b) ++{ ++ char oldch1, oldch2; ++ char *abuf, *bbuf; ++ char *str1, *str2; ++ char * one, * two; ++ int rc; ++ int isnum; ++ int ret = 0; ++ ++ grub_dprintf("blscfg", "%s comparing %s and %s\n", __func__, a, b); ++ if (!grub_strcmp(a, b)) ++ return 0; ++ ++ abuf = grub_malloc(grub_strlen(a) + 1); ++ bbuf = grub_malloc(grub_strlen(b) + 1); ++ str1 = abuf; ++ str2 = bbuf; ++ grub_strcpy(str1, a); ++ grub_strcpy(str2, b); ++ ++ one = str1; ++ two = str2; ++ ++ /* loop through each version segment of str1 and str2 and compare them */ ++ while (*one || *two) { ++ while (*one && !grub_isalnum(*one) && *one != '~') one++; ++ while (*two && !grub_isalnum(*two) && *two != '~') two++; ++ ++ /* handle the tilde separator, it sorts before everything else */ ++ if (*one == '~' || *two == '~') { ++ if (*one != '~') goto_return (1); ++ if (*two != '~') goto_return (-1); ++ one++; ++ two++; ++ continue; ++ } ++ ++ /* If we ran to the end of either, we are finished with the loop */ ++ if (!(*one && *two)) break; ++ ++ str1 = one; ++ str2 = two; ++ ++ /* grab first completely alpha or completely numeric segment */ ++ /* leave one and two pointing to the start of the alpha or numeric */ ++ /* segment and walk str1 and str2 to end of segment */ ++ if (grub_isdigit(*str1)) { ++ while (*str1 && grub_isdigit(*str1)) str1++; ++ while (*str2 && grub_isdigit(*str2)) str2++; ++ isnum = 1; ++ } else { ++ while (*str1 && grub_isalpha(*str1)) str1++; ++ while (*str2 && grub_isalpha(*str2)) str2++; ++ isnum = 0; ++ } ++ ++ /* save character at the end of the alpha or numeric segment */ ++ /* so that they can be restored after the comparison */ ++ oldch1 = *str1; ++ *str1 = '\0'; ++ oldch2 = *str2; ++ *str2 = '\0'; ++ ++ /* this cannot happen, as we previously tested to make sure that */ ++ /* the first string has a non-null segment */ ++ if (one == str1) goto_return(-1); /* arbitrary */ ++ ++ /* take care of the case where the two version segments are */ ++ /* different types: one numeric, the other alpha (i.e. empty) */ ++ /* numeric segments are always newer than alpha segments */ ++ /* XXX See patch #60884 (and details) from bugzilla #50977. */ ++ if (two == str2) goto_return (isnum ? 1 : -1); ++ ++ if (isnum) { ++ grub_size_t onelen, twolen; ++ /* this used to be done by converting the digit segments */ ++ /* to ints using atoi() - it's changed because long */ ++ /* digit segments can overflow an int - this should fix that. */ ++ ++ /* throw away any leading zeros - it's a number, right? */ ++ while (*one == '0') one++; ++ while (*two == '0') two++; ++ ++ /* whichever number has more digits wins */ ++ onelen = grub_strlen(one); ++ twolen = grub_strlen(two); ++ if (onelen > twolen) goto_return (1); ++ if (twolen > onelen) goto_return (-1); ++ } ++ ++ /* grub_strcmp will return which one is greater - even if the two */ ++ /* segments are alpha or if they are numeric. don't return */ ++ /* if they are equal because there might be more segments to */ ++ /* compare */ ++ rc = grub_strcmp(one, two); ++ if (rc) goto_return (rc < 1 ? -1 : 1); ++ ++ /* restore character that was replaced by null above */ ++ *str1 = oldch1; ++ one = str1; ++ *str2 = oldch2; ++ two = str2; ++ } ++ ++ /* this catches the case where all numeric and alpha segments have */ ++ /* compared identically but the segment sepparating characters were */ ++ /* different */ ++ if ((!*one) && (!*two)) goto_return (0); ++ ++ /* whichever version still has characters left over wins */ ++ if (!*one) goto_return (-1); else goto_return (1); ++ ++finish: ++ grub_free (abuf); ++ grub_free (bbuf); ++ return ret; ++} ++ ++/* returns name/version/release */ ++/* NULL string pointer returned if nothing found */ ++static void ++split_package_string (char *package_string, char **name, ++ char **version, char **release) ++{ ++ char *package_version, *package_release; ++ ++ /* Release */ ++ package_release = grub_strrchr (package_string, '-'); ++ ++ if (package_release != NULL) ++ *package_release++ = '\0'; ++ ++ *release = package_release; ++ ++ if (name == NULL) ++ { ++ *version = package_string; ++ } ++ else ++ { ++ /* Version */ ++ package_version = grub_strrchr(package_string, '-'); ++ ++ if (package_version != NULL) ++ *package_version++ = '\0'; ++ ++ *version = package_version; ++ /* Name */ ++ *name = package_string; ++ } ++ ++ /* Bubble up non-null values from release to name */ ++ if (name != NULL && *name == NULL) ++ { ++ *name = (*version == NULL ? *release : *version); ++ *version = *release; ++ *release = NULL; ++ } ++ if (*version == NULL) ++ { ++ *version = *release; ++ *release = NULL; ++ } ++} ++ ++static int ++split_cmp(char *nvr0, char *nvr1, int has_name) ++{ ++ int ret = 0; ++ char *name0, *version0, *release0; ++ char *name1, *version1, *release1; ++ ++ split_package_string(nvr0, has_name ? &name0 : NULL, &version0, &release0); ++ split_package_string(nvr1, has_name ? &name1 : NULL, &version1, &release1); ++ ++ if (has_name) ++ { ++ ret = vercmp(name0 == NULL ? "" : name0, ++ name1 == NULL ? "" : name1); ++ if (ret != 0) ++ return ret; ++ } ++ ++ ret = vercmp(version0 == NULL ? "" : version0, ++ version1 == NULL ? "" : version1); ++ if (ret != 0) ++ return ret; ++ ++ ret = vercmp(release0 == NULL ? "" : release0, ++ release1 == NULL ? "" : release1); ++ return ret; ++} ++ ++/* return 1: e0 is newer than e1 */ ++/* 0: e0 and e1 are the same version */ ++/* -1: e1 is newer than e0 */ ++static int bls_cmp(const struct bls_entry *e0, const struct bls_entry *e1) ++{ ++ char *id0, *id1; ++ int r; ++ ++ id0 = grub_strdup(e0->filename); ++ id1 = grub_strdup(e1->filename); ++ ++ r = split_cmp(id0, id1, 1); ++ ++ grub_free(id0); ++ grub_free(id1); ++ ++ return r; ++} ++ ++static void list_add_tail(struct bls_entry *head, struct bls_entry *item) ++{ ++ item->next = head; ++ if (head->prev) ++ head->prev->next = item; ++ item->prev = head->prev; ++ head->prev = item; ++} ++ ++static int bls_add_entry(struct bls_entry *entry) ++{ ++ struct bls_entry *e, *last = NULL; ++ int rc; ++ ++ if (!entries) { ++ grub_dprintf ("blscfg", "Add entry with id \"%s\"\n", entry->filename); ++ entries = entry; ++ return 0; ++ } ++ ++ FOR_BLS_ENTRIES(e) { ++ rc = bls_cmp(entry, e); ++ ++ if (!rc) ++ return GRUB_ERR_BAD_ARGUMENT; ++ ++ if (rc == 1) { ++ grub_dprintf ("blscfg", "Add entry with id \"%s\"\n", entry->filename); ++ list_add_tail (e, entry); ++ if (e == entries) { ++ entries = entry; ++ entry->prev = NULL; ++ } ++ return 0; ++ } ++ last = e; ++ } ++ ++ if (last) { ++ grub_dprintf ("blscfg", "Add entry with id \"%s\"\n", entry->filename); ++ last->next = entry; ++ entry->prev = last; ++ } ++ ++ return 0; ++} ++ ++struct read_entry_info { ++ const char *devid; ++ const char *dirname; ++ grub_file_t file; ++}; ++ ++static int read_entry ( + const char *filename, -+ const struct grub_dirhook_info *info __attribute__ ((unused)), -+ void *data __attribute__ ((unused))) ++ const struct grub_dirhook_info *dirhook_info UNUSED, ++ void *data) +{ -+ grub_size_t n; -+ char *p; ++ grub_size_t m = 0, n, clip = 0; ++ int rc = 0; ++ char *p = NULL; + grub_file_t f = NULL; -+ grub_off_t sz; -+ char *title = NULL, *options = NULL, *clinux = NULL, *initrd = NULL, *src = NULL; -+ const char *args[2] = { NULL, NULL }; ++ struct bls_entry *entry; ++ struct read_entry_info *info = (struct read_entry_info *)data; + -+ if (filename[0] == '.') -+ return 0; ++ grub_dprintf ("blscfg", "filename: \"%s\"\n", filename); + + n = grub_strlen (filename); -+ if (n <= 5) -+ return 0; + -+ if (grub_strcmp (filename + n - 5, ".conf") != 0) -+ return 0; ++ if (info->file) ++ { ++ f = info->file; ++ } ++ else ++ { ++ if (filename[0] == '.') ++ return 0; ++ ++ if (n <= 5) ++ return 0; + -+ p = grub_xasprintf (GRUB_BLS_CONFIG_PATH "%s", filename); ++ if (grub_strcmp (filename + n - 5, ".conf") != 0) ++ return 0; ++ ++ p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename); ++ ++ f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG); ++ if (!f) ++ goto finish; ++ } + -+ f = grub_file_open (p); -+ if (!f) ++ entry = grub_zalloc (sizeof (*entry)); ++ if (!entry) + goto finish; + -+ sz = grub_file_size (f); -+ if (sz == GRUB_FILE_SIZE_UNKNOWN || sz > 1024*1024) ++ if (info->file) ++ { ++ char *slash; ++ ++ if (n > 5 && !grub_strcmp (filename + n - 5, ".conf") == 0) ++ clip = 5; ++ ++ slash = grub_strrchr (filename, '/'); ++ if (!slash) ++ slash = grub_strrchr (filename, '\\'); ++ ++ while (*slash == '/' || *slash == '\\') ++ slash++; ++ ++ m = slash ? slash - filename : 0; ++ } ++ else ++ { ++ m = 0; ++ clip = 5; ++ } ++ n -= m; ++ ++ entry->filename = grub_strndup(filename + m, n - clip); ++ if (!entry->filename) + goto finish; + ++ entry->filename[n - 5] = '\0'; ++ + for (;;) + { + char *buf; ++ char *separator; + + buf = grub_file_getline (f); + if (!buf) + break; + -+ if (grub_strncmp (buf, "title ", 6) == 0) ++ while (buf && buf[0] && (buf[0] == ' ' || buf[0] == '\t')) ++ buf++; ++ if (buf[0] == '#') ++ continue; ++ ++ separator = grub_strchr (buf, ' '); ++ ++ if (!separator) ++ separator = grub_strchr (buf, '\t'); ++ ++ if (!separator || separator[1] == '\0') + { -+ grub_free (title); -+ title = grub_strdup (buf + 6); -+ if (!title) -+ goto finish; ++ grub_free (buf); ++ break; + } -+ else if (grub_strncmp (buf, "options ", 8) == 0) ++ ++ separator[0] = '\0'; ++ ++ do { ++ separator++; ++ } while (*separator == ' ' || *separator == '\t'); ++ ++ rc = bls_add_keyval (entry, buf, separator); ++ grub_free (buf); ++ if (rc < 0) ++ break; ++ } ++ ++ if (!rc) ++ bls_add_entry(entry); ++ ++finish: ++ if (p) ++ grub_free (p); ++ ++ if (f) ++ grub_file_close (f); ++ ++ return 0; ++} ++ ++static grub_envblk_t saved_env = NULL; ++ ++static int UNUSED ++save_var (const char *name, const char *value, void *whitelist UNUSED) ++{ ++ const char *val = grub_env_get (name); ++ grub_dprintf("blscfg", "saving \"%s\"\n", name); ++ ++ if (val) ++ grub_envblk_set (saved_env, name, value); ++ ++ return 0; ++} ++ ++static int UNUSED ++unset_var (const char *name, const char *value UNUSED, void *whitelist) ++{ ++ grub_dprintf("blscfg", "restoring \"%s\"\n", name); ++ if (! whitelist) ++ { ++ grub_env_unset (name); ++ return 0; ++ } ++ ++ if (test_whitelist_membership (name, ++ (const grub_env_whitelist_t *) whitelist)) ++ grub_env_unset (name); ++ ++ return 0; ++} ++ ++static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) ++{ ++ int last = -1; ++ char *val; ++ ++ int nlist = 0; ++ char **list = NULL; ++ ++ list = grub_malloc (sizeof (char *)); ++ if (!list) ++ return NULL; ++ list[0] = NULL; ++ ++ while (1) ++ { ++ char **new; ++ ++ val = bls_get_val (entry, key, &last); ++ if (!val) ++ break; ++ ++ new = grub_realloc (list, (nlist + 2) * sizeof (char *)); ++ if (!new) ++ break; ++ ++ list = new; ++ list[nlist++] = val; ++ list[nlist] = NULL; ++ } ++ ++ if (num) ++ *num = nlist; ++ ++ return list; ++} ++ ++static char *field_append(bool is_var, char *buffer, char *start, char *end) ++{ ++ char *temp = grub_strndup(start, end - start + 1); ++ const char *field = temp; ++ ++ if (is_var) { ++ field = grub_env_get (temp); ++ if (!field) ++ return buffer; ++ } ++ ++ if (!buffer) { ++ buffer = grub_strdup(field); ++ if (!buffer) ++ return NULL; ++ } else { ++ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field)); ++ if (!buffer) ++ return NULL; ++ ++ grub_stpcpy (buffer + grub_strlen(buffer), field); ++ } ++ ++ return buffer; ++} ++ ++static char *expand_val(char *value) ++{ ++ char *buffer = NULL; ++ char *start = value; ++ char *end = value; ++ bool is_var = false; ++ ++ if (!value) ++ return NULL; ++ ++ while (*value) { ++ if (*value == '$') { ++ if (start != end) { ++ buffer = field_append(is_var, buffer, start, end); ++ if (!buffer) ++ return NULL; ++ } ++ ++ is_var = true; ++ start = value + 1; ++ } else if (is_var) { ++ if (!grub_isalnum(*value) && *value != '_') { ++ buffer = field_append(is_var, buffer, start, end); ++ is_var = false; ++ start = value; ++ } ++ } ++ ++ end = value; ++ value++; ++ } ++ ++ if (start != end) { ++ buffer = field_append(is_var, buffer, start, end); ++ if (!buffer) ++ return NULL; ++ } ++ ++ return buffer; ++} ++ ++static char **early_initrd_list (const char *initrd) ++{ ++ int nlist = 0; ++ char **list = NULL; ++ char *separator; ++ ++ while ((separator = grub_strchr (initrd, ' '))) ++ { ++ list = grub_realloc (list, (nlist + 2) * sizeof (char *)); ++ if (!list) ++ return NULL; ++ ++ list[nlist++] = grub_strndup(initrd, separator - initrd); ++ list[nlist] = NULL; ++ initrd = separator + 1; ++ } ++ ++ list = grub_realloc (list, (nlist + 2) * sizeof (char *)); ++ if (!list) ++ return NULL; ++ ++ list[nlist++] = grub_strndup(initrd, grub_strlen(initrd)); ++ list[nlist] = NULL; ++ ++ return list; ++} ++ ++static void create_entry (struct bls_entry *entry) ++{ ++ int argc = 0; ++ const char **argv = NULL; ++ ++ char *title = NULL; ++ char *clinux = NULL; ++ char *options = NULL; ++ char **initrds = NULL; ++ char *initrd = NULL; ++ const char *early_initrd = NULL; ++ char **early_initrds = NULL; ++ char *initrd_prefix = NULL; ++ char *id = entry->filename; ++ char *dotconf = id; ++ char *hotkey = NULL; ++ ++ char *users = NULL; ++ char **classes = NULL; ++ ++ char **args = NULL; ++ ++ char *src = NULL; ++ int i, index; ++ ++ grub_dprintf("blscfg", "%s got here\n", __func__); ++ clinux = bls_get_val (entry, "linux", NULL); ++ if (!clinux) ++ { ++ grub_dprintf ("blscfg", "Skipping file %s with no 'linux' key.\n", entry->filename); ++ goto finish; ++ } ++ ++ /* ++ * strip the ".conf" off the end before we make it our "id" field. ++ */ ++ do ++ { ++ dotconf = grub_strstr(dotconf, ".conf"); ++ } while (dotconf != NULL && dotconf[5] != '\0'); ++ if (dotconf) ++ dotconf[0] = '\0'; ++ ++ title = bls_get_val (entry, "title", NULL); ++ options = expand_val (bls_get_val (entry, "options", NULL)); ++ ++ if (!options) ++ options = expand_val (grub_env_get("default_kernelopts")); ++ ++ initrds = bls_make_list (entry, "initrd", NULL); ++ ++ hotkey = bls_get_val (entry, "grub_hotkey", NULL); ++ users = expand_val (bls_get_val (entry, "grub_users", NULL)); ++ classes = bls_make_list (entry, "grub_class", NULL); ++ args = bls_make_list (entry, "grub_arg", &argc); ++ ++ argc += 1; ++ argv = grub_malloc ((argc + 1) * sizeof (char *)); ++ argv[0] = title ? title : clinux; ++ for (i = 1; i < argc; i++) ++ argv[i] = args[i-1]; ++ argv[argc] = NULL; ++ ++ early_initrd = grub_env_get("early_initrd"); ++ ++ grub_dprintf ("blscfg", "adding menu entry for \"%s\" with id \"%s\"\n", ++ title, id); ++ if (early_initrd) ++ { ++ early_initrds = early_initrd_list(early_initrd); ++ if (!early_initrds) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; ++ } ++ ++ if (initrds != NULL && initrds[0] != NULL) + { -+ grub_free (options); -+ options = grub_strdup (buf + 8); -+ if (!options) -+ goto finish; ++ initrd_prefix = grub_strrchr (initrds[0], '/'); ++ initrd_prefix = grub_strndup(initrds[0], initrd_prefix - initrds[0] + 1); + } -+ else if (grub_strncmp (buf, "linux ", 6) == 0) ++ else + { -+ grub_free (clinux); -+ clinux = grub_strdup (buf + 6); -+ if (!clinux) -+ goto finish; ++ initrd_prefix = grub_strrchr (clinux, '/'); ++ initrd_prefix = grub_strndup(clinux, initrd_prefix - clinux + 1); + } -+ else if (grub_strncmp (buf, "initrd ", 7) == 0) ++ ++ if (!initrd_prefix) + { -+ grub_free (initrd); -+ initrd = grub_strdup (buf + 7); -+ if (!initrd) -+ goto finish; ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; + } -+ -+ grub_free(buf); + } + -+ if (!linux) ++ if (early_initrds || initrds) + { -+ grub_printf ("Skipping file %s with no 'linux' key.", p); -+ goto finish; -+ } ++ int initrd_size = sizeof ("initrd"); ++ char *tmp; ++ ++ for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++) ++ initrd_size += sizeof (" " GRUB_BOOT_DEVICE) \ ++ + grub_strlen(initrd_prefix) \ ++ + grub_strlen (early_initrds[i]) + 1; ++ ++ for (i = 0; initrds != NULL && initrds[i] != NULL; i++) ++ initrd_size += sizeof (" " GRUB_BOOT_DEVICE) \ ++ + grub_strlen (initrds[i]) + 1; ++ initrd_size += 1; ++ ++ initrd = grub_malloc (initrd_size); ++ if (!initrd) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; ++ } ++ ++ ++ tmp = grub_stpcpy(initrd, "initrd"); ++ for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++) ++ { ++ grub_dprintf ("blscfg", "adding early initrd %s\n", early_initrds[i]); ++ tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ tmp = grub_stpcpy (tmp, initrd_prefix); ++ tmp = grub_stpcpy (tmp, early_initrds[i]); ++ grub_free(early_initrds[i]); ++ } + -+ args[0] = title ? title : filename; ++ for (i = 0; initrds != NULL && initrds[i] != NULL; i++) ++ { ++ grub_dprintf ("blscfg", "adding initrd %s\n", initrds[i]); ++ tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ tmp = grub_stpcpy (tmp, initrds[i]); ++ } ++ tmp = grub_stpcpy (tmp, "\n"); ++ } + + src = grub_xasprintf ("load_video\n" -+ "set gfx_payload=keep\n" ++ "set gfxpayload=keep\n" + "insmod gzio\n" -+ GRUB_LINUX_CMD " %s%s%s%s\n" -+ "%s%s%s%s", ++ "linux %s%s%s%s\n" ++ "%s", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", -+ initrd ? GRUB_INITRD_CMD " " : "", initrd ? GRUB_BOOT_DEVICE : "", initrd ? initrd : "", initrd ? "\n" : ""); ++ initrd ? initrd : ""); + -+ grub_normal_add_menu_entry (1, args, NULL, NULL, "bls", NULL, NULL, src, 0); ++ grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry); ++ grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id); + +finish: -+ grub_free (p); -+ grub_free (title); -+ grub_free (options); -+ grub_free (clinux); + grub_free (initrd); ++ grub_free (initrd_prefix); ++ grub_free (early_initrds); ++ grub_free (initrds); ++ grub_free (options); ++ grub_free (classes); ++ grub_free (args); ++ grub_free (argv); + grub_free (src); ++} + -+ if (f) -+ grub_file_close (f); ++struct find_entry_info { ++ const char *dirname; ++ const char *devid; ++ grub_device_t dev; ++ grub_fs_t fs; ++}; ++ ++/* ++ * info: the filesystem object the file is on. ++ */ ++static int find_entry (struct find_entry_info *info) ++{ ++ struct read_entry_info read_entry_info; ++ grub_fs_t blsdir_fs = NULL; ++ grub_device_t blsdir_dev = NULL; ++ const char *blsdir = info->dirname; ++ int fallback = 0; ++ int r = 0; ++ ++ if (!blsdir) { ++ blsdir = grub_env_get ("blsdir"); ++ if (!blsdir) ++ blsdir = GRUB_BLS_CONFIG_PATH; ++ } ++ ++ read_entry_info.file = NULL; ++ read_entry_info.dirname = blsdir; ++ ++ grub_dprintf ("blscfg", "scanning blsdir: %s\n", blsdir); ++ ++ blsdir_dev = info->dev; ++ blsdir_fs = info->fs; ++ read_entry_info.devid = info->devid; ++ ++read_fallback: ++ r = blsdir_fs->fs_dir (blsdir_dev, read_entry_info.dirname, read_entry, ++ &read_entry_info); ++ if (r != 0) { ++ grub_dprintf ("blscfg", "read_entry returned error\n"); ++ grub_err_t e; ++ do ++ { ++ e = grub_error_pop(); ++ } while (e); ++ } ++ ++ if (r && !info->dirname && !fallback) { ++ read_entry_info.dirname = "/boot" GRUB_BLS_CONFIG_PATH; ++ grub_dprintf ("blscfg", "Entries weren't found in %s, fallback to %s\n", ++ blsdir, read_entry_info.dirname); ++ fallback = 1; ++ goto read_fallback; ++ } + + return 0; +} + +static grub_err_t -+grub_cmd_bls_import (grub_extcmd_context_t ctxt __attribute__ ((unused)), -+ int argc __attribute__ ((unused)), -+ char **args __attribute__ ((unused))) ++bls_load_entries (const char *path) +{ ++ grub_size_t len; + grub_fs_t fs; + grub_device_t dev; + static grub_err_t r; -+ const char *devid; ++ const char *devid = NULL; ++ char *blsdir = NULL; ++ struct find_entry_info info = { ++ .dev = NULL, ++ .fs = NULL, ++ .dirname = NULL, ++ }; ++ struct read_entry_info rei = { ++ .devid = NULL, ++ .dirname = NULL, ++ }; ++ ++ if (path) { ++ len = grub_strlen (path); ++ if (grub_strcmp (path + len - 5, ".conf") == 0) { ++ rei.file = grub_file_open (path, GRUB_FILE_TYPE_CONFIG); ++ if (!rei.file) ++ return grub_errno; ++ /* ++ * read_entry() closes the file ++ */ ++ return read_entry(path, NULL, &rei); ++ } else if (path[0] == '(') { ++ devid = path + 1; ++ ++ blsdir = grub_strchr (path, ')'); ++ if (!blsdir) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Filepath isn't correct")); ++ ++ *blsdir = '\0'; ++ blsdir = blsdir + 1; ++ } ++ } + -+ devid = grub_env_get ("root"); -+ if (!devid) -+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "root"); ++ if (!devid) { ++#ifdef GRUB_MACHINE_EMU ++ devid = "host"; ++#elif defined(GRUB_MACHINE_EFI) ++ devid = grub_env_get ("root"); ++#else ++ devid = grub_env_get ("boot"); ++#endif ++ if (!devid) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, ++ N_("variable `%s' isn't set"), "boot"); ++ } + ++ grub_dprintf ("blscfg", "opening %s\n", devid); + dev = grub_device_open (devid); + if (!dev) + return grub_errno; + ++ grub_dprintf ("blscfg", "probing fs\n"); + fs = grub_fs_probe (dev); + if (!fs) + { @@ -178,7 +972,11 @@ diff -urNp grub-2.02-rc1.orig/grub-core/commands/blscfg.c grub-2.02-rc1/grub-cor + goto finish; + } + -+ r = fs->dir (dev, GRUB_BLS_CONFIG_PATH, parse_entry, NULL); ++ info.dirname = blsdir; ++ info.devid = devid; ++ info.dev = dev; ++ info.fs = fs; ++ find_entry(&info); + +finish: + if (dev) @@ -187,37 +985,503 @@ diff -urNp grub-2.02-rc1.orig/grub-core/commands/blscfg.c grub-2.02-rc1/grub-cor + return r; +} + ++static bool ++is_default_entry(const char *def_entry, struct bls_entry *entry, int idx) ++{ ++ const char *title; ++ int def_idx; ++ ++ if (!def_entry) ++ return false; ++ ++ if (grub_strcmp(def_entry, entry->filename) == 0) ++ return true; ++ ++ title = bls_get_val(entry, "title", NULL); ++ ++ if (title && grub_strcmp(def_entry, title) == 0) ++ return true; ++ ++ def_idx = (int)grub_strtol(def_entry, NULL, 0); ++ if (grub_errno == GRUB_ERR_BAD_NUMBER) { ++ grub_errno = GRUB_ERR_NONE; ++ return false; ++ } ++ ++ if (def_idx == idx) ++ return true; ++ ++ return false; ++} ++ ++static grub_err_t ++bls_create_entries (bool show_default, bool show_non_default, char *entry_id) ++{ ++ const char *def_entry = NULL; ++ struct bls_entry *entry = NULL; ++ int idx = 0; ++ ++ def_entry = grub_env_get("default"); ++ ++ grub_dprintf ("blscfg", "%s Creating entries from bls\n", __func__); ++ FOR_BLS_ENTRIES(entry) { ++ if (entry->visible) { ++ idx++; ++ continue; ++ } ++ ++ if ((show_default && is_default_entry(def_entry, entry, idx)) || ++ (show_non_default && !is_default_entry(def_entry, entry, idx)) || ++ (entry_id && grub_strcmp(entry_id, entry->filename) == 0)) { ++ create_entry(entry); ++ entry->visible = 1; ++ } ++ idx++; ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_blscfg (grub_extcmd_context_t ctxt UNUSED, ++ int argc, char **args) ++{ ++ grub_err_t r; ++ char *path = NULL; ++ char *entry_id = NULL; ++ bool show_default = true; ++ bool show_non_default = true; ++ ++ if (argc == 1) { ++ if (grub_strcmp (args[0], "default") == 0) { ++ show_non_default = false; ++ } else if (grub_strcmp (args[0], "non-default") == 0) { ++ show_default = false; ++ } else if (args[0][0] == '(') { ++ path = args[0]; ++ } else { ++ entry_id = args[0]; ++ show_default = false; ++ show_non_default = false; ++ } ++ } ++ ++ r = bls_load_entries(path); ++ if (r) ++ return r; ++ ++ return bls_create_entries(show_default, show_non_default, entry_id); ++} ++ +static grub_extcmd_t cmd; ++static grub_extcmd_t oldcmd; + -+GRUB_MOD_INIT(bls) ++GRUB_MOD_INIT(blscfg) +{ -+ cmd = grub_register_extcmd ("bls_import", -+ grub_cmd_bls_import, ++ grub_dprintf("blscfg", "%s got here\n", __func__); ++ cmd = grub_register_extcmd ("blscfg", ++ grub_cmd_blscfg, + 0, + NULL, + N_("Import Boot Loader Specification snippets."), + NULL); ++ oldcmd = grub_register_extcmd ("bls_import", ++ grub_cmd_blscfg, ++ 0, ++ NULL, ++ N_("Import Boot Loader Specification snippets."), ++ NULL); +} + -+GRUB_MOD_FINI(bls) ++GRUB_MOD_FINI(blscfg) +{ + grub_unregister_extcmd (cmd); ++ grub_unregister_extcmd (oldcmd); +} -diff -urNp grub-2.02-rc1.orig/grub-core/Makefile.core.def grub-2.02-rc1/grub-core/Makefile.core.def ---- grub-2.02-rc1.orig/grub-core/Makefile.core.def 2017-02-08 15:09:05.594315418 +0000 -+++ grub-2.02-rc1/grub-core/Makefile.core.def 2017-02-08 15:09:21.549315239 +0000 -@@ -742,6 +742,14 @@ module = { +diff -urN grub-2.04.orig/grub-core/commands/legacycfg.c grub-2.04/grub-core/commands/legacycfg.c +--- grub-2.04.orig/grub-core/commands/legacycfg.c 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/grub-core/commands/legacycfg.c 2019-08-18 16:14:44.723000000 +0200 +@@ -133,7 +133,7 @@ + args[0] = oldname; + grub_normal_add_menu_entry (1, args, NULL, NULL, "legacy", + NULL, NULL, +- entrysrc, 0); ++ entrysrc, 0, NULL, NULL); + grub_free (args); + entrysrc[0] = 0; + grub_free (oldname); +@@ -186,7 +186,8 @@ + } + args[0] = entryname; + grub_normal_add_menu_entry (1, args, NULL, NULL, NULL, +- NULL, NULL, entrysrc, 0); ++ NULL, NULL, entrysrc, 0, NULL, ++ NULL); + grub_free (args); + } + +diff -urN grub-2.04.orig/grub-core/commands/loadenv.c grub-2.04/grub-core/commands/loadenv.c +--- grub-2.04.orig/grub-core/commands/loadenv.c 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/grub-core/commands/loadenv.c 2019-08-18 16:14:44.723000000 +0200 +@@ -28,6 +28,8 @@ + #include + #include + ++#include "loadenv.h" ++ + GRUB_MOD_LICENSE ("GPLv3+"); + + static const struct grub_arg_option options[] = +@@ -79,81 +81,6 @@ + return file; + } + +-static grub_envblk_t +-read_envblk_file (grub_file_t file) +-{ +- grub_off_t offset = 0; +- char *buf; +- grub_size_t size = grub_file_size (file); +- grub_envblk_t envblk; +- +- buf = grub_malloc (size); +- if (! buf) +- return 0; +- +- while (size > 0) +- { +- grub_ssize_t ret; +- +- ret = grub_file_read (file, buf + offset, size); +- if (ret <= 0) +- { +- grub_free (buf); +- return 0; +- } +- +- size -= ret; +- offset += ret; +- } +- +- envblk = grub_envblk_open (buf, offset); +- if (! envblk) +- { +- grub_free (buf); +- grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid environment block"); +- return 0; +- } +- +- return envblk; +-} +- +-struct grub_env_whitelist +-{ +- grub_size_t len; +- char **list; +-}; +-typedef struct grub_env_whitelist grub_env_whitelist_t; +- +-static int +-test_whitelist_membership (const char* name, +- const grub_env_whitelist_t* whitelist) +-{ +- grub_size_t i; +- +- for (i = 0; i < whitelist->len; i++) +- if (grub_strcmp (name, whitelist->list[i]) == 0) +- return 1; /* found it */ +- +- return 0; /* not found */ +-} +- +-/* Helper for grub_cmd_load_env. */ +-static int +-set_var (const char *name, const char *value, void *whitelist) +-{ +- if (! whitelist) +- { +- grub_env_set (name, value); +- return 0; +- } +- +- if (test_whitelist_membership (name, +- (const grub_env_whitelist_t *) whitelist)) +- grub_env_set (name, value); +- +- return 0; +-} +- + static grub_err_t + grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args) + { +diff -urN grub-2.04.orig/grub-core/commands/loadenv.h grub-2.04/grub-core/commands/loadenv.h +--- grub-2.04.orig/grub-core/commands/loadenv.h 1970-01-01 01:00:00.000000000 +0100 ++++ grub-2.04/grub-core/commands/loadenv.h 2019-08-18 16:14:44.724000000 +0200 +@@ -0,0 +1,93 @@ ++/* loadenv.c - command to load/save environment variable. */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++static grub_envblk_t UNUSED ++read_envblk_file (grub_file_t file) ++{ ++ grub_off_t offset = 0; ++ char *buf; ++ grub_size_t size = grub_file_size (file); ++ grub_envblk_t envblk; ++ ++ buf = grub_malloc (size); ++ if (! buf) ++ return 0; ++ ++ while (size > 0) ++ { ++ grub_ssize_t ret; ++ ++ ret = grub_file_read (file, buf + offset, size); ++ if (ret <= 0) ++ { ++ grub_free (buf); ++ return 0; ++ } ++ ++ size -= ret; ++ offset += ret; ++ } ++ ++ envblk = grub_envblk_open (buf, offset); ++ if (! envblk) ++ { ++ grub_free (buf); ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid environment block"); ++ return 0; ++ } ++ ++ return envblk; ++} ++ ++struct grub_env_whitelist ++{ ++ grub_size_t len; ++ char **list; ++}; ++typedef struct grub_env_whitelist grub_env_whitelist_t; ++ ++static int UNUSED ++test_whitelist_membership (const char* name, ++ const grub_env_whitelist_t* whitelist) ++{ ++ grub_size_t i; ++ ++ for (i = 0; i < whitelist->len; i++) ++ if (grub_strcmp (name, whitelist->list[i]) == 0) ++ return 1; /* found it */ ++ ++ return 0; /* not found */ ++} ++ ++/* Helper for grub_cmd_load_env. */ ++static int UNUSED ++set_var (const char *name, const char *value, void *whitelist) ++{ ++ if (! whitelist) ++ { ++ grub_env_set (name, value); ++ return 0; ++ } ++ ++ if (test_whitelist_membership (name, ++ (const grub_env_whitelist_t *) whitelist)) ++ grub_env_set (name, value); ++ ++ return 0; ++} +diff -urN grub-2.04.orig/grub-core/commands/menuentry.c grub-2.04/grub-core/commands/menuentry.c +--- grub-2.04.orig/grub-core/commands/menuentry.c 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/grub-core/commands/menuentry.c 2019-08-18 16:14:44.723000000 +0200 +@@ -78,7 +78,7 @@ + char **classes, const char *id, + const char *users, const char *hotkey, + const char *prefix, const char *sourcecode, +- int submenu) ++ int submenu, int *index, struct bls_entry *bls) + { + int menu_hotkey = 0; + char **menu_args = NULL; +@@ -149,9 +149,12 @@ + if (! menu_title) + goto fail; + ++ grub_dprintf ("menu", "id:\"%s\"\n", id); ++ grub_dprintf ("menu", "title:\"%s\"\n", menu_title); + menu_id = grub_strdup (id ? : menu_title); + if (! menu_id) + goto fail; ++ grub_dprintf ("menu", "menu_id:\"%s\"\n", menu_id); + + /* Save argc, args to pass as parameters to block arg later. */ + menu_args = grub_malloc (sizeof (char*) * (argc + 1)); +@@ -170,8 +173,12 @@ + } + + /* Add the menu entry at the end of the list. */ ++ int ind=0; + while (*last) +- last = &(*last)->next; ++ { ++ ind++; ++ last = &(*last)->next; ++ } + + *last = grub_zalloc (sizeof (**last)); + if (! *last) +@@ -188,8 +195,11 @@ + (*last)->args = menu_args; + (*last)->sourcecode = menu_sourcecode; + (*last)->submenu = submenu; ++ (*last)->bls = bls; + + menu->size++; ++ if (index) ++ *index = ind; + return GRUB_ERR_NONE; + + fail: +@@ -286,7 +296,8 @@ + users, + ctxt->state[2].arg, 0, + ctxt->state[3].arg, +- ctxt->extcmd->cmd->name[0] == 's'); ++ ctxt->extcmd->cmd->name[0] == 's', ++ NULL, NULL); + + src = args[argc - 1]; + args[argc - 1] = NULL; +@@ -303,7 +314,8 @@ + ctxt->state[0].args, ctxt->state[4].arg, + users, + ctxt->state[2].arg, prefix, src + 1, +- ctxt->extcmd->cmd->name[0] == 's'); ++ ctxt->extcmd->cmd->name[0] == 's', NULL, ++ NULL); + + src[len - 1] = ch; + args[argc - 1] = src; +diff -urN grub-2.04.orig/grub-core/Makefile.core.def grub-2.04/grub-core/Makefile.core.def +--- grub-2.04.orig/grub-core/Makefile.core.def 2019-04-23 10:54:47.000000000 +0200 ++++ grub-2.04/grub-core/Makefile.core.def 2019-08-18 16:14:44.723000000 +0200 +@@ -810,6 +810,16 @@ }; module = { + name = blscfg; + common = commands/blscfg.c; -+ enable = i386_efi; -+ enable = x86_64_efi; ++ common = commands/loadenv.h; ++ enable = powerpc_ieee1275; ++ enable = efi; + enable = i386_pc; ++ enable = emu; +}; + +module = { name = boot; common = commands/boot.c; i386_pc = lib/i386/pc/biosnum.c; +@@ -986,6 +996,7 @@ + module = { + name = loadenv; + common = commands/loadenv.c; ++ common = commands/loadenv.h; + common = lib/envblk.c; + }; + +diff -urN grub-2.04.orig/grub-core/normal/main.c grub-2.04/grub-core/normal/main.c +--- grub-2.04.orig/grub-core/normal/main.c 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/grub-core/normal/main.c 2019-08-18 16:14:44.724000000 +0200 +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -66,6 +67,11 @@ + grub_free (entry->args); + } + ++ if (entry->bls) ++ { ++ entry->bls->visible = 0; ++ } ++ + grub_free ((void *) entry->id); + grub_free ((void *) entry->users); + grub_free ((void *) entry->title); +diff -urN grub-2.04.orig/include/grub/compiler.h grub-2.04/include/grub/compiler.h +--- grub-2.04.orig/include/grub/compiler.h 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/include/grub/compiler.h 2019-08-18 16:14:44.724000000 +0200 +@@ -48,4 +48,6 @@ + # define WARN_UNUSED_RESULT + #endif + ++#define UNUSED __attribute__((__unused__)) ++ + #endif /* ! GRUB_COMPILER_HEADER */ +diff -urN grub-2.04.orig/include/grub/menu.h grub-2.04/include/grub/menu.h +--- grub-2.04.orig/include/grub/menu.h 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/include/grub/menu.h 2019-08-18 16:14:44.724000000 +0200 +@@ -20,6 +20,16 @@ + #ifndef GRUB_MENU_HEADER + #define GRUB_MENU_HEADER 1 + ++struct bls_entry ++{ ++ struct bls_entry *next; ++ struct bls_entry *prev; ++ struct keyval **keyvals; ++ int nkeyvals; ++ char *filename; ++ int visible; ++}; ++ + struct grub_menu_entry_class + { + char *name; +@@ -60,6 +70,9 @@ + + /* The next element. */ + struct grub_menu_entry *next; ++ ++ /* BLS used to populate the entry */ ++ struct bls_entry *bls; + }; + typedef struct grub_menu_entry *grub_menu_entry_t; + +diff -urN grub-2.04.orig/include/grub/normal.h grub-2.04/include/grub/normal.h +--- grub-2.04.orig/include/grub/normal.h 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/include/grub/normal.h 2019-08-18 16:14:44.724000000 +0200 +@@ -145,7 +145,7 @@ + const char *id, + const char *users, const char *hotkey, + const char *prefix, const char *sourcecode, +- int submenu); ++ int submenu, int *index, struct bls_entry *bls); + + grub_err_t + grub_normal_set_password (const char *user, const char *password); diff --git a/efi-net-fix.patch b/efi-net-fix.patch index 4cc5e13..aec2324 100644 --- a/efi-net-fix.patch +++ b/efi-net-fix.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/grub-core/net/drivers/efi/efinet.c grub-2.02-rc1/grub-core/net/drivers/efi/efinet.c ---- grub-2.02-rc1.orig/grub-core/net/drivers/efi/efinet.c 2017-02-08 15:08:35.748315754 +0000 -+++ grub-2.02-rc1/grub-core/net/drivers/efi/efinet.c 2017-02-08 15:08:53.837315551 +0000 -@@ -330,6 +330,7 @@ grub_efi_net_config_real (grub_efi_handl +diff -ur grub-2.04.orig/grub-core/net/drivers/efi/efinet.c grub-2.04/grub-core/net/drivers/efi/efinet.c +--- grub-2.04.orig/grub-core/net/drivers/efi/efinet.c 2019-08-18 15:57:09.662000000 +0200 ++++ grub-2.04/grub-core/net/drivers/efi/efinet.c 2019-08-18 15:57:25.366000000 +0200 +@@ -330,6 +330,7 @@ { struct grub_net_card *card; grub_efi_device_path_t *dp; @@ -9,7 +9,7 @@ diff -urNp grub-2.02-rc1.orig/grub-core/net/drivers/efi/efinet.c grub-2.02-rc1/g dp = grub_efi_get_device_path (hnd); if (! dp) -@@ -383,6 +384,21 @@ grub_efi_net_config_real (grub_efi_handl +@@ -383,6 +384,21 @@ &pxe_mode->dhcp_ack, sizeof (pxe_mode->dhcp_ack), 1, device, path); diff --git a/gcc8.patch b/gcc8.patch deleted file mode 100644 index a3915c8..0000000 --- a/gcc8.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -ur grub-2.02.orig/grub-core/fs/btrfs.c grub-2.02/grub-core/fs/btrfs.c ---- grub-2.02.orig/grub-core/fs/btrfs.c 2017-04-24 09:16:00.000000000 +0000 -+++ grub-2.02/grub-core/fs/btrfs.c 2018-09-04 11:11:43.199082290 +0000 -@@ -175,7 +175,7 @@ - { - grub_int64_t sec; - grub_uint32_t nanosec; --} __attribute__ ((aligned (4))); -+} GRUB_PACKED; - - struct grub_btrfs_inode - { -diff -ur grub-2.02.orig/include/grub/efiemu/runtime.h grub-2.02/include/grub/efiemu/runtime.h ---- grub-2.02.orig/include/grub/efiemu/runtime.h 2015-05-21 15:50:29.000000000 +0000 -+++ grub-2.02/include/grub/efiemu/runtime.h 2018-09-04 11:13:30.211081085 +0000 -@@ -29,7 +29,7 @@ - - struct efi_variable - { -- grub_efi_guid_t guid; -+ grub_efi_packed_guid_t guid; - grub_uint32_t namelen; - grub_uint32_t size; - grub_efi_uint32_t attributes; -diff -ur grub-2.02.orig/include/grub/gpt_partition.h grub-2.02/include/grub/gpt_partition.h ---- grub-2.02.orig/include/grub/gpt_partition.h 2015-05-21 15:50:29.000000000 +0000 -+++ grub-2.02/include/grub/gpt_partition.h 2018-09-04 11:14:00.554080743 +0000 -@@ -28,7 +28,7 @@ - grub_uint16_t data2; - grub_uint16_t data3; - grub_uint8_t data4[8]; --} __attribute__ ((aligned(8))); -+} GRUB_PACKED; - typedef struct grub_gpt_part_type grub_gpt_part_type_t; - - #define GRUB_GPT_PARTITION_TYPE_EMPTY \ diff --git a/grub-garbage.patch b/grub-garbage.patch index 57eb6d4..9fd9737 100644 --- a/grub-garbage.patch +++ b/grub-garbage.patch @@ -1,11 +1,11 @@ -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig_lib.in grub-2.02-rc1/util/grub-mkconfig_lib.in ---- grub-2.02-rc1.orig/util/grub-mkconfig_lib.in 2017-02-08 15:01:40.196320433 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig_lib.in 2017-02-08 15:01:59.899320211 +0000 -@@ -187,6 +187,7 @@ grub_file_is_not_garbage () +diff -ur grub-2.04.orig/util/grub-mkconfig_lib.in grub-2.04/util/grub-mkconfig_lib.in +--- grub-2.04.orig/util/grub-mkconfig_lib.in 2019-08-18 15:42:13.463000000 +0200 ++++ grub-2.04/util/grub-mkconfig_lib.in 2019-08-18 15:42:40.188000000 +0200 +@@ -187,6 +187,7 @@ case "$1" in *.dpkg-*) return 1 ;; # debian dpkg *.rpmsave|*.rpmnew) return 1 ;; + *.bak|*~|.*.swp) return 1 ;; # backup and swap files from editors README*|*/README*) return 1 ;; # documentation + *.sig) return 1 ;; # signatures esac - else diff --git a/grub-lvmdevice.patch b/grub-lvmdevice.patch index e28add5..d9b6be7 100644 --- a/grub-lvmdevice.patch +++ b/grub-lvmdevice.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkconfig.in ---- grub-2.02-rc1.orig/util/grub-mkconfig.in 2017-02-08 15:00:50.000000000 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig.in 2017-02-08 15:02:35.564319810 +0000 -@@ -133,6 +133,21 @@ fi +diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in +--- grub-2.04.orig/util/grub-mkconfig.in 2019-08-18 15:43:15.196000000 +0200 ++++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:43:33.498000000 +0200 +@@ -133,6 +133,21 @@ # Device containing our userland. Typically used for root= parameter. GRUB_DEVICE="`${grub_probe} --target=device /`" @@ -21,5 +21,5 @@ diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkco +esac + GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true + GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true - # Device containing our /boot partition. Usually the same as GRUB_DEVICE. diff --git a/grub-mkconfig-diagnostics.patch b/grub-mkconfig-diagnostics.patch index 58c3cad..afc95b4 100644 --- a/grub-mkconfig-diagnostics.patch +++ b/grub-mkconfig-diagnostics.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/util/grub.d/00_header.in grub-2.02-rc1/util/grub.d/00_header.in ---- grub-2.02-rc1.orig/util/grub.d/00_header.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/00_header.in 2017-02-08 15:03:25.069319252 +0000 -@@ -229,7 +229,7 @@ esac +diff -ur grub-2.04.orig/util/grub.d/00_header.in grub-2.04/util/grub.d/00_header.in +--- grub-2.04.orig/util/grub.d/00_header.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/00_header.in 2019-08-18 15:45:18.507000000 +0200 +@@ -229,7 +229,7 @@ if [ "x$gfxterm" = x1 ]; then if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \ && is_path_readable_by_grub "$GRUB_THEME"; then @@ -10,7 +10,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/00_header.in grub-2.02-rc1/util/grub.d prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` cat << EOF -@@ -265,12 +265,12 @@ export theme +@@ -265,12 +265,12 @@ EOF elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \ && is_path_readable_by_grub "$GRUB_BACKGROUND"; then @@ -25,10 +25,10 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/00_header.in grub-2.02-rc1/util/grub.d esac prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` cat << EOF -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_hurd.in grub-2.02-rc1/util/grub.d/10_hurd.in ---- grub-2.02-rc1.orig/util/grub.d/10_hurd.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/10_hurd.in 2017-02-08 15:03:25.069319252 +0000 -@@ -45,8 +45,8 @@ for i in /boot/gnumach* ; do +diff -ur grub-2.04.orig/util/grub.d/10_hurd.in grub-2.04/util/grub.d/10_hurd.in +--- grub-2.04.orig/util/grub.d/10_hurd.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/10_hurd.in 2019-08-18 15:45:18.508000000 +0200 +@@ -45,8 +45,8 @@ basename=`basename $i` dirname=`dirname $i` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -39,7 +39,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_hurd.in grub-2.02-rc1/util/grub.d/1 kernels="${kernels} ${rel_dirname}/${basename}" at_least_one=true fi -@@ -60,8 +60,8 @@ esac +@@ -60,8 +60,8 @@ for i in /hurd/${hurd_fs}.static /hurd/exec ; do if test -e "$i" ; then @@ -50,7 +50,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_hurd.in grub-2.02-rc1/util/grub.d/1 at_least_one=true else all_of_them=false -@@ -74,8 +74,8 @@ if ${at_least_one} ; then : ; else +@@ -74,8 +74,8 @@ fi if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else @@ -61,10 +61,10 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_hurd.in grub-2.02-rc1/util/grub.d/1 exit 1 fi -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_kfreebsd.in grub-2.02-rc1/util/grub.d/10_kfreebsd.in ---- grub-2.02-rc1.orig/util/grub.d/10_kfreebsd.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/10_kfreebsd.in 2017-02-08 15:03:25.069319252 +0000 -@@ -161,7 +161,7 @@ is_top_level=true +diff -ur grub-2.04.orig/util/grub.d/10_kfreebsd.in grub-2.04/util/grub.d/10_kfreebsd.in +--- grub-2.04.orig/util/grub.d/10_kfreebsd.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/10_kfreebsd.in 2019-08-18 15:45:18.508000000 +0200 +@@ -161,7 +161,7 @@ while [ "x$list" != "x" ] ; do kfreebsd=`version_find_latest $list` @@ -73,7 +73,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_kfreebsd.in grub-2.02-rc1/util/grub basename=`basename $kfreebsd` dirname=`dirname $kfreebsd` rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -210,7 +210,7 @@ while [ "x$list" != "x" ] ; do +@@ -210,7 +210,7 @@ fi done if test -n "${module_dir}" ; then @@ -82,10 +82,10 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_kfreebsd.in grub-2.02-rc1/util/grub module_dir_rel=$(make_system_path_relative_to_its_root $module_dir) fi -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_linux.in grub-2.02-rc1/util/grub.d/10_linux.in ---- grub-2.02-rc1.orig/util/grub.d/10_linux.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/10_linux.in 2017-02-08 15:03:25.070319252 +0000 -@@ -180,7 +180,7 @@ submenu_indentation="" +diff -ur grub-2.04.orig/util/grub.d/10_linux.in grub-2.04/util/grub.d/10_linux.in +--- grub-2.04.orig/util/grub.d/10_linux.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/10_linux.in 2019-08-18 15:46:11.888000000 +0200 +@@ -194,7 +194,7 @@ is_top_level=true while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` @@ -94,19 +94,19 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_linux.in grub-2.02-rc1/util/grub.d/ basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -217,7 +217,7 @@ while [ "x$list" != "x" ] ; do +@@ -233,7 +233,7 @@ + for i in ${initrd}; do + initrd_display="${initrd_display} ${dirname}/${i}" + done +- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 ++ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&3 fi - if test -n "${initrd}" ; then -- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 -+ gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&3 - elif test -z "${initramfs}" ; then - # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's - # no initrd or builtin initramfs, it can't work here. -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_netbsd.in grub-2.02-rc1/util/grub.d/10_netbsd.in ---- grub-2.02-rc1.orig/util/grub.d/10_netbsd.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/10_netbsd.in 2017-02-08 15:03:25.070319252 +0000 -@@ -155,7 +155,7 @@ for k in /netbsd $(ls -t /netbsd?* 2>/de + config= +diff -ur grub-2.04.orig/util/grub.d/10_netbsd.in grub-2.04/util/grub.d/10_netbsd.in +--- grub-2.04.orig/util/grub.d/10_netbsd.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/10_netbsd.in 2019-08-18 15:45:18.508000000 +0200 +@@ -155,7 +155,7 @@ continue fi @@ -115,10 +115,10 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_netbsd.in grub-2.02-rc1/util/grub.d if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then netbsd_entry "knetbsd" "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}" -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_windows.in grub-2.02-rc1/util/grub.d/10_windows.in ---- grub-2.02-rc1.orig/util/grub.d/10_windows.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/10_windows.in 2017-02-08 15:03:25.070319252 +0000 -@@ -82,7 +82,7 @@ for drv in $drives ; do +diff -ur grub-2.04.orig/util/grub.d/10_windows.in grub-2.04/util/grub.d/10_windows.in +--- grub-2.04.orig/util/grub.d/10_windows.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/10_windows.in 2019-08-18 15:45:18.508000000 +0200 +@@ -82,7 +82,7 @@ # Get boot device. dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue @@ -127,11 +127,11 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_windows.in grub-2.02-rc1/util/grub. cat << EOF menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' { EOF -diff -urNp grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in grub-2.02-rc1/util/grub.d/20_linux_xen.in ---- grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/20_linux_xen.in 2017-02-08 15:03:25.070319252 +0000 -@@ -208,7 +208,7 @@ while [ "x${xen_list}" != "x" ] ; do - fi +diff -ur grub-2.04.orig/util/grub.d/20_linux_xen.in grub-2.04/util/grub.d/20_linux_xen.in +--- grub-2.04.orig/util/grub.d/20_linux_xen.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/20_linux_xen.in 2019-08-18 15:46:22.468000000 +0200 +@@ -243,7 +243,7 @@ + while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` - gettext_printf "Found linux image: %s\n" "$linux" >&2 @@ -139,19 +139,28 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in grub-2.02-rc1/util/gru basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -231,7 +231,7 @@ while [ "x${xen_list}" != "x" ] ; do - fi - done - if test -n "${initrd}" ; then -- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 -+ gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&3 - else - # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. - linux_root_device_thisversion=${GRUB_DEVICE} -diff -urNp grub-2.02-rc1.orig/util/grub.d/30_os-prober.in grub-2.02-rc1/util/grub.d/30_os-prober.in ---- grub-2.02-rc1.orig/util/grub.d/30_os-prober.in 2017-02-08 15:03:12.814319390 +0000 -+++ grub-2.02-rc1/util/grub.d/30_os-prober.in 2017-02-08 15:03:25.070319252 +0000 -@@ -141,7 +141,7 @@ for OS in ${OSPROBED} ; do +@@ -274,7 +274,7 @@ + for i in ${initrd}; do + initrd_display="${initrd_display} ${dirname}/${i}" + done +- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 ++ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&3 + fi + + if test -z "${initrd_real}"; then +diff -ur grub-2.04.orig/util/grub.d/30_os-prober.in grub-2.04/util/grub.d/30_os-prober.in +--- grub-2.04.orig/util/grub.d/30_os-prober.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub.d/30_os-prober.in 2019-08-18 15:47:18.536000000 +0200 +@@ -123,7 +123,7 @@ + fi + + if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then +- echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 ++ echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&3 + continue + fi + fi +@@ -141,7 +141,7 @@ # os-prober returns text string followed by optional counter CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')" @@ -160,7 +169,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/30_os-prober.in grub-2.02-rc1/util/gru case ${BOOT} in chain) -@@ -329,7 +329,7 @@ EOF +@@ -329,7 +329,7 @@ ;; *) # TRANSLATORS: %s is replaced by OS name. @@ -169,10 +178,10 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/30_os-prober.in grub-2.02-rc1/util/gru ;; esac done -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkconfig.in ---- grub-2.02-rc1.orig/util/grub-mkconfig.in 2017-02-08 15:03:12.813319390 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig.in 2017-02-08 15:04:41.230318395 +0000 -@@ -247,11 +247,16 @@ export GRUB_DEFAULT \ +diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in +--- grub-2.04.orig/util/grub-mkconfig.in 2019-08-18 15:45:01.994000000 +0200 ++++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:45:18.509000000 +0200 +@@ -258,11 +258,16 @@ if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" oldumask=$(umask); umask 077 @@ -191,7 +200,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkco cat << EOF # -@@ -286,8 +291,8 @@ if test "x${grub_cfg}" != "x" ; then +@@ -297,8 +302,8 @@ gettext_printf "Syntax errors are detected in generated GRUB config file. Ensure that there are no errors in /etc/sysconfig/grub and /etc/grub.d/* files or please file a bug report with @@ -202,7 +211,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkco exit 1 else # none of the children aborted with error, install the new grub.cfg -@@ -295,5 +300,8 @@ and /etc/grub.d/* files or please file a +@@ -306,5 +311,8 @@ fi fi diff --git a/grub2-cfg.patch b/grub2-cfg.patch index 4547116..5d5ba9c 100644 --- a/grub2-cfg.patch +++ b/grub2-cfg.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/docs/grub.cfg grub-2.02-rc1/docs/grub.cfg ---- grub-2.02-rc1.orig/docs/grub.cfg 2017-02-08 15:07:55.114316212 +0000 -+++ grub-2.02-rc1/docs/grub.cfg 2017-02-08 15:08:12.255316019 +0000 -@@ -14,8 +14,8 @@ set fallback=gnuhurd +diff -ur grub-2.04.orig/docs/grub.cfg grub-2.04/docs/grub.cfg +--- grub-2.04.orig/docs/grub.cfg 2019-08-18 15:56:16.561000000 +0200 ++++ grub-2.04/docs/grub.cfg 2019-08-18 15:56:54.745000000 +0200 +@@ -14,8 +14,8 @@ # For booting GNU/Linux menuentry "GNU/Linux" --id gnulinux { set root=(hd0,msdos1) diff --git a/grub2-fonts_path.patch b/grub2-fonts_path.patch index 0acce4f..f5dbe8c 100644 --- a/grub2-fonts_path.patch +++ b/grub2-fonts_path.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/configure.ac grub-2.02-rc1/configure.ac ---- grub-2.02-rc1.orig/configure.ac 2017-02-08 15:05:29.599317850 +0000 -+++ grub-2.02-rc1/configure.ac 2017-02-08 15:05:43.268317696 +0000 -@@ -1622,7 +1622,7 @@ fi +diff -ur grub-2.04.orig/configure.ac grub-2.04/configure.ac +--- grub-2.04.orig/configure.ac 2019-08-18 15:50:10.737000000 +0200 ++++ grub-2.04/configure.ac 2019-08-18 15:50:22.087000000 +0200 +@@ -1649,7 +1649,7 @@ if test x"$starfield_excuse" = x; then for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do @@ -10,7 +10,7 @@ diff -urNp grub-2.02-rc1.orig/configure.ac grub-2.02-rc1/configure.ac if test -f "$dir/DejaVuSans.$ext"; then DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" break 2 -@@ -1644,7 +1644,7 @@ AC_SUBST([DJVU_FONT_SOURCE]) +@@ -1671,7 +1671,7 @@ FONT_SOURCE= for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do diff --git a/grub2.spec b/grub2.spec index 851a630..59388fb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -37,12 +37,12 @@ Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 gépekhez Summary(pl.UTF-8): GRUB2 - bootloader dla x86 Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2 Name: grub2 -Version: 2.02 -Release: 3 +Version: 2.04 +Release: 1 License: GPL v2 Group: Base Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz -# Source0-md5: 8a4a2a95aac551fb0fba860ceabfa1d3 +# Source0-md5: 5aaca6713b47ca2456d8324a58755ac7 Source1: update-grub Source2: update-grub.8 Source3: grub.sysconfig @@ -54,15 +54,13 @@ Patch4: tld-mkconfigdir.patch Patch5: grub-mkconfig-diagnostics.patch Patch6: posix.patch Patch7: %{name}-fonts_path.patch -Patch8: add-vlan-tag-support.patch -Patch9: just-say-linux.patch -Patch10: ignore-kernel-symlinks.patch -Patch11: initrd-search.patch -Patch12: %{name}-cfg.patch -Patch13: efi-net-fix.patch -Patch14: blscfg.patch -Patch15: restricted.patch -Patch16: gcc8.patch +Patch8: just-say-linux.patch +Patch9: ignore-kernel-symlinks.patch +Patch10: initrd-search.patch +Patch11: %{name}-cfg.patch +Patch12: efi-net-fix.patch +Patch13: blscfg.patch +Patch14: restricted.patch URL: http://www.gnu.org/software/grub/ BuildRequires: autoconf >= 2.53 BuildRequires: automake >= 1:1.11.1-1 @@ -284,8 +282,6 @@ Motyw starfield dla GRUB-a. %patch12 -p1 %patch13 -p1 %patch14 -p1 -%patch15 -p1 -%patch16 -p1 # we don't have C.utf-8 and need an UTF-8 locale for build sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules* diff --git a/ignore-kernel-symlinks.patch b/ignore-kernel-symlinks.patch index 2c3776d..23f3adc 100644 --- a/ignore-kernel-symlinks.patch +++ b/ignore-kernel-symlinks.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig_lib.in grub-2.02-rc1/util/grub-mkconfig_lib.in ---- grub-2.02-rc1.orig/util/grub-mkconfig_lib.in 2017-02-08 15:06:56.145316876 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig_lib.in 2017-02-08 15:07:12.391316693 +0000 -@@ -183,6 +183,9 @@ grub_get_device_id () +diff -ur grub-2.04.orig/util/grub-mkconfig_lib.in grub-2.04/util/grub-mkconfig_lib.in +--- grub-2.04.orig/util/grub-mkconfig_lib.in 2019-08-18 15:53:18.700000000 +0200 ++++ grub-2.04/util/grub-mkconfig_lib.in 2019-08-18 15:53:29.906000000 +0200 +@@ -183,6 +183,9 @@ grub_file_is_not_garbage () { diff --git a/initrd-search.patch b/initrd-search.patch index 2f56cbf..fc22efc 100644 --- a/initrd-search.patch +++ b/initrd-search.patch @@ -1,10 +1,10 @@ -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_linux.in grub-2.02-rc1/util/grub.d/10_linux.in ---- grub-2.02-rc1.orig/util/grub.d/10_linux.in 2017-02-08 15:07:23.361316569 +0000 -+++ grub-2.02-rc1/util/grub.d/10_linux.in 2017-02-08 15:07:45.006316326 +0000 -@@ -189,10 +189,7 @@ while [ "x$list" != "x" ] ; do - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" +diff -ur grub-2.04.orig/util/grub.d/10_linux.in grub-2.04/util/grub.d/10_linux.in +--- grub-2.04.orig/util/grub.d/10_linux.in 2019-08-18 15:53:40.493000000 +0200 ++++ grub-2.04/util/grub.d/10_linux.in 2019-08-18 15:55:25.547000000 +0200 +@@ -211,10 +211,7 @@ + done - initrd= + initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ - "initrd-${version}" "initramfs-${version}.img" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ @@ -13,13 +13,13 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_linux.in grub-2.02-rc1/util/grub.d/ "initramfs-genkernel-${version}" \ "initramfs-genkernel-${alt_version}" \ "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ -diff -urNp grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in grub-2.02-rc1/util/grub.d/20_linux_xen.in ---- grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in 2017-02-08 15:07:23.361316569 +0000 -+++ grub-2.02-rc1/util/grub.d/20_linux_xen.in 2017-02-08 15:07:45.007316326 +0000 -@@ -217,10 +217,7 @@ while [ "x${xen_list}" != "x" ] ; do +diff -ur grub-2.04.orig/util/grub.d/20_linux_xen.in grub-2.04/util/grub.d/20_linux_xen.in +--- grub-2.04.orig/util/grub.d/20_linux_xen.in 2019-08-18 15:53:40.493000000 +0200 ++++ grub-2.04/util/grub.d/20_linux_xen.in 2019-08-18 15:55:58.507000000 +0200 +@@ -252,10 +252,7 @@ linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" - initrd= + initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ - "initrd-${version}" "initramfs-${version}.img" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ diff --git a/just-say-linux.patch b/just-say-linux.patch index 15321c8..21eeed9 100644 --- a/just-say-linux.patch +++ b/just-say-linux.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/util/grub.d/10_linux.in grub-2.02-rc1/util/grub.d/10_linux.in ---- grub-2.02-rc1.orig/util/grub.d/10_linux.in 2017-02-08 15:06:29.571317175 +0000 -+++ grub-2.02-rc1/util/grub.d/10_linux.in 2017-02-08 15:06:42.287317032 +0000 -@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" +diff -ur grub-2.04.orig/util/grub.d/10_linux.in grub-2.04/util/grub.d/10_linux.in +--- grub-2.04.orig/util/grub.d/10_linux.in 2019-08-18 15:50:55.155000000 +0200 ++++ grub-2.04/util/grub.d/10_linux.in 2019-08-18 15:53:05.494000000 +0200 +@@ -29,9 +29,9 @@ CLASS="--class gnu-linux --class gnu --class os" if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then @@ -13,10 +13,10 @@ diff -urNp grub-2.02-rc1.orig/util/grub.d/10_linux.in grub-2.02-rc1/util/grub.d/ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" fi -diff -urNp grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in grub-2.02-rc1/util/grub.d/20_linux_xen.in ---- grub-2.02-rc1.orig/util/grub.d/20_linux_xen.in 2017-02-08 15:06:29.571317175 +0000 -+++ grub-2.02-rc1/util/grub.d/20_linux_xen.in 2017-02-08 15:06:42.288317032 +0000 -@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" +diff -ur grub-2.04.orig/util/grub.d/20_linux_xen.in grub-2.04/util/grub.d/20_linux_xen.in +--- grub-2.04.orig/util/grub.d/20_linux_xen.in 2019-08-18 15:50:55.155000000 +0200 ++++ grub-2.04/util/grub.d/20_linux_xen.in 2019-08-18 15:53:05.494000000 +0200 +@@ -29,9 +29,9 @@ CLASS="--class gnu-linux --class gnu --class os --class xen" if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then diff --git a/posix.patch b/posix.patch index 4ef9c50..72a7197 100644 --- a/posix.patch +++ b/posix.patch @@ -1,6 +1,6 @@ -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkconfig.in ---- grub-2.02-rc1.orig/util/grub-mkconfig.in 2017-02-08 15:05:01.428318167 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig.in 2017-02-08 15:05:13.547318031 +0000 +diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in +--- grub-2.04.orig/util/grub-mkconfig.in 2019-08-18 15:49:45.245000000 +0200 ++++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:49:57.907000000 +0200 @@ -1,5 +1,6 @@ #! /bin/sh set -e diff --git a/restricted.patch b/restricted.patch index f5324df..53c1e42 100644 --- a/restricted.patch +++ b/restricted.patch @@ -1,6 +1,6 @@ -diff -ur grub-2.02.orig/util/grub.d/10_linux.in grub-2.02/util/grub.d/10_linux.in ---- grub-2.02.orig/util/grub.d/10_linux.in 2018-09-04 10:42:04.656102314 +0000 -+++ grub-2.02/util/grub.d/10_linux.in 2018-09-04 11:00:55.728089580 +0000 +diff -ur grub-2.04.orig/util/grub.d/10_linux.in grub-2.04/util/grub.d/10_linux.in +--- grub-2.04.orig/util/grub.d/10_linux.in 2019-08-18 15:58:15.105000000 +0200 ++++ grub-2.04/util/grub.d/10_linux.in 2019-08-18 15:58:28.665000000 +0200 @@ -28,6 +28,12 @@ CLASS="--class gnu-linux --class gnu --class os" @@ -14,7 +14,7 @@ diff -ur grub-2.02.orig/util/grub.d/10_linux.in grub-2.02/util/grub.d/10_linux.i if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS="$(. /etc/os-release ; echo "$NAME $VERSION")" else -@@ -92,9 +98,9 @@ +@@ -102,9 +108,9 @@ title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" fi @@ -26,9 +26,9 @@ diff -ur grub-2.02.orig/util/grub.d/10_linux.in grub-2.02/util/grub.d/10_linux.i fi if [ x$type != xrecovery ] ; then save_default_entry | grub_add_tab -diff -ur grub-2.02.orig/util/grub.d/30_os-prober.in grub-2.02/util/grub.d/30_os-prober.in ---- grub-2.02.orig/util/grub.d/30_os-prober.in 2018-09-04 10:42:04.649102314 +0000 -+++ grub-2.02/util/grub.d/30_os-prober.in 2018-09-04 11:01:57.024088889 +0000 +diff -ur grub-2.04.orig/util/grub.d/30_os-prober.in grub-2.04/util/grub.d/30_os-prober.in +--- grub-2.04.orig/util/grub.d/30_os-prober.in 2019-08-18 15:58:15.105000000 +0200 ++++ grub-2.04/util/grub.d/30_os-prober.in 2019-08-18 15:58:28.665000000 +0200 @@ -30,6 +30,12 @@ exit 0 fi @@ -96,10 +96,10 @@ diff -ur grub-2.02.orig/util/grub.d/30_os-prober.in grub-2.02/util/grub.d/30_os- EOF save_default_entry | grub_add_tab prepare_grub_to_access_device ${DEVICE} | grub_add_tab -diff -ur grub-2.02.orig/util/grub-mkconfig.in grub-2.02/util/grub-mkconfig.in ---- grub-2.02.orig/util/grub-mkconfig.in 2018-09-04 10:42:04.650102314 +0000 -+++ grub-2.02/util/grub-mkconfig.in 2018-09-04 10:50:40.159096510 +0000 -@@ -243,7 +243,8 @@ +diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in +--- grub-2.04.orig/util/grub-mkconfig.in 2019-08-18 15:58:15.106000000 +0200 ++++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:58:28.666000000 +0200 +@@ -254,7 +254,8 @@ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ diff --git a/tld-mkconfigdir.patch b/tld-mkconfigdir.patch index 9363459..3ab26d7 100644 --- a/tld-mkconfigdir.patch +++ b/tld-mkconfigdir.patch @@ -1,7 +1,7 @@ -diff -urNp grub-2.02-rc1.orig/conf/Makefile.common grub-2.02-rc1/conf/Makefile.common ---- grub-2.02-rc1.orig/conf/Makefile.common 2017-02-08 15:02:48.901319660 +0000 -+++ grub-2.02-rc1/conf/Makefile.common 2017-02-08 15:03:00.772319526 +0000 -@@ -61,7 +61,7 @@ CCASFLAGS_LIBRARY = +diff -ur grub-2.04.orig/conf/Makefile.common grub-2.04/conf/Makefile.common +--- grub-2.04.orig/conf/Makefile.common 2019-08-18 15:43:56.021000000 +0200 ++++ grub-2.04/conf/Makefile.common 2019-08-18 15:44:44.088000000 +0200 +@@ -61,7 +61,7 @@ # Other variables @@ -10,10 +10,10 @@ diff -urNp grub-2.02-rc1.orig/conf/Makefile.common grub-2.02-rc1/conf/Makefile.c platformdir = $(pkglibdir)/$(target_cpu)-$(platform) starfielddir = $(pkgdatadir)/themes/starfield -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkconfig.in ---- grub-2.02-rc1.orig/util/grub-mkconfig.in 2017-02-08 15:02:48.949319659 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig.in 2017-02-08 15:03:00.772319526 +0000 -@@ -37,7 +37,7 @@ fi +diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in +--- grub-2.04.orig/util/grub-mkconfig.in 2019-08-18 15:43:56.080000000 +0200 ++++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:44:44.089000000 +0200 +@@ -37,7 +37,7 @@ export pkgdatadir grub_cfg="" diff --git a/tld-sysconfdir.patch b/tld-sysconfdir.patch index f5f0809..5334cca 100644 --- a/tld-sysconfdir.patch +++ b/tld-sysconfdir.patch @@ -1,17 +1,17 @@ -diff -urNp grub-2.02-rc1.orig/util/grub.d/README grub-2.02-rc1/util/grub.d/README ---- grub-2.02-rc1.orig/util/grub.d/README 2017-02-03 19:17:48.000000000 +0000 -+++ grub-2.02-rc1/util/grub.d/README 2017-02-08 15:00:50.481320993 +0000 -@@ -8,4 +8,4 @@ All executable files in this directory a +diff -ur grub-2.04.orig/util/grub.d/README grub-2.04/util/grub.d/README +--- grub-2.04.orig/util/grub.d/README 2018-11-24 18:13:02.000000000 +0100 ++++ grub-2.04/util/grub.d/README 2019-08-18 15:41:16.068000000 +0200 +@@ -8,4 +8,4 @@ The number namespace in-between is configurable by system installer and/or administrator. For example, you can add an entry to boot another OS as 01_otheros, 11_otheros, etc, depending on the position you want it to occupy in -the menu; and then adjust the default setting via /etc/default/grub. +the menu; and then adjust the default setting via /etc/sysconfig/grub. -diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkconfig.in ---- grub-2.02-rc1.orig/util/grub-mkconfig.in 2017-02-03 19:17:48.000000000 +0000 -+++ grub-2.02-rc1/util/grub-mkconfig.in 2017-02-08 15:00:50.481320993 +0000 -@@ -147,8 +147,8 @@ if [ x"$GRUB_FS" = xunknown ]; then - GRUB_FS="$(stat -f --printf=%T / || echo unknown)" +diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in +--- grub-2.04.orig/util/grub-mkconfig.in 2019-05-20 12:59:36.000000000 +0200 ++++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:41:16.068000000 +0200 +@@ -154,8 +154,8 @@ + GRUB_EARLY_INITRD_LINUX_STOCK="intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode.cpio" fi -if test -f ${sysconfdir}/default/grub ; then @@ -21,7 +21,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkco fi # XXX: should this be deprecated at some point? -@@ -243,7 +243,7 @@ cat << EOF +@@ -254,7 +254,7 @@ # DO NOT EDIT THIS FILE # # It is automatically generated by $self using templates @@ -30,7 +30,7 @@ diff -urNp grub-2.02-rc1.orig/util/grub-mkconfig.in grub-2.02-rc1/util/grub-mkco # EOF -@@ -269,7 +269,7 @@ if test "x${grub_cfg}" != "x" ; then +@@ -280,7 +280,7 @@ if ! ${grub_script_check} ${grub_cfg}.new; then # TRANSLATORS: %s is replaced by filename gettext_printf "Syntax errors are detected in generated GRUB config file. -- 2.46.0