Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37919117
en ru br
ALT Linux repos
S:1.77-alt3

Group :: System/Configuration/Boot and Init
RPM: os-prober

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: os-prober-1.77-alt-grub2-detect-auto-reference.patch
Download


From 162fae27eadbe24a33a7b65425f21549d2a611cc Mon Sep 17 00:00:00 2001
From: Nikolai Kostrigin <nickel@altlinux.org>
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
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin