blob: afd0ff55cd8d9043494b8664b7d14d34774e6a29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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"
|