summaryrefslogtreecommitdiff
path: root/sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-01-28 00:37:32 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-01-28 00:37:32 +0000
commit3f81fd7097ec931ebf6d862622e6d81834483dbb (patch)
treee8381bb314f59122a26bd714f1a14993a31ab8ee /sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch
parent351bdb27fc041435144b39e022d9830c140ebd3a (diff)
sys-boot/os-prober : shamelessly take all the patches from openSUSE Factory to make it work
Diffstat (limited to 'sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch')
-rw-r--r--sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch b/sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch
new file mode 100644
index 00000000..afd0ff55
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.49-fix-grub2.cfg-parsing.patch
@@ -0,0 +1,55 @@
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Subject: fix parsing GRUB2 grub.cfg
+References: bnc#796919
+
+Fix several problems in parsing of grub.cfg by
+linux-boot-probes/mounted/40grub2
+
+1. Look for /boot/grub2-efi/grub.cfg as well (openSUSE 12.2)
+
+2. It checked for literal "(on /dev/.*)" to filter out menu entries
+added by another os-prober on target system. But grub.cfg now includes
+TRANSLATED strings, so this check will fail if grub.cfg was created in
+non-English locale. Use menu entry ID to check whether entry was added
+by os-prober (it always starts with osprober-). Suggested by Vladimir
+Serbienko.
+Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2
+===================================================================
+--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2
++++ os-prober-1.61/linux-boot-probes/mounted/common/40grub2
+@@ -43,6 +43,13 @@ parse_grub_menu () {
+ menuentry)
+ entry_result
+ shift 1
++ # Currently GRUB2 puts translated strings
++ # in grub.cfg, so checking for verbatim
++ # (on /dev/.*) will fail if target grub.cfg
++ # was created in non-English locale. Extract
++ # menu entry ID and check if it starts with
++ # "osprober-"
++ id="$(echo "$line" | sed -n 's/^.*[[:space:]]\+\(\$menuentry_id_option\|--id\)[[:space:]]\+\([^[:space:]]\+\).*$/\2/p')"
+ # The double-quoted string is the title.
+ # Make sure to look at the text of the line
+ # before 'set' mangled it.
+@@ -58,9 +65,9 @@ parse_grub_menu () {
+ fi
+ if [ -z "$title" ]; then
+ ignore_item=1
+- elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then
++ elif echo "$title" | grep -q '(on /dev/[^)]*)$' || echo "$id" | grep -q "^\([\"']\|\)osprober-"; then
+ log "Skipping entry '$title':"
+- log "appears to be an automatic reference taken from another menu.lst"
++ log "appears to be an automatic reference taken from another grub.cfg"
+ ignore_item=1
+ fi
+ ;;
+@@ -98,6 +105,9 @@ if [ -e "$mpoint/boot/grub/grub.cfg" ] &
+ [ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then
+ debug "parsing grub.cfg"
+ parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg"
++elif [ -e "$mpoint/boot/grub2-efi/grub.cfg" ]; then
++ debug "parsing grub.cfg"
++ parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2-efi/grub.cfg"
+ elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then
+ debug "parsing grub.cfg"
+ parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg"