From 162fae27eadbe24a33a7b65425f21549d2a611cc Mon Sep 17 00:00:00 2001 From: Nikolai Kostrigin Date: Fri, 6 Mar 2020 13:32:47 +0300 Subject: [PATCH] 40grub2: improve detectability of automatic references --- linux-boot-probes/mounted/common/40grub2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/linux-boot-probes/mounted/common/40grub2 b/linux-boot-probes/mounted/common/40grub2 index 885614e..f747d0c 100755 --- a/linux-boot-probes/mounted/common/40grub2 +++ b/linux-boot-probes/mounted/common/40grub2 @@ -33,6 +33,7 @@ parse_grub_menu () { initrd="" title="" ignore_item=0 + ignore_section=0 while read line; do debug "parsing: $line" @@ -56,9 +57,17 @@ parse_grub_menu () { # strings on the same line. title="$(echo "$line" | sed -n "s/[^']*'\(\([^']\|'\\\\''\)*\)'.*/\1/p" | sed "s/'\\\\''/'/; s/://g")" fi + + # when parsing localized grub.cfg we may fail to bypass an automatic reference + # so try harder to search for both English and localized versions + ontext_l10n="$(gettext "grub" "(on %s)" |sed "s/\((\)\(.*\)\([[:blank:]]%s)\)/\2/")" + if [ -z "${ontext_l10n}" ]; then + ontext_l10n="on" + fi + if [ -z "$title" ]; then ignore_item=1 - elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then + elif echo "$title" | grep -q '(\(on\|${ontext_l10n}\) /dev/[^)]*)$'; then log "Skipping entry '$title':" log "appears to be an automatic reference taken from another menu.lst" ignore_item=1 -- 2.25.1