From a1b1445158a0cc9194727172358ccbd817a2dff0 Mon Sep 17 00:00:00 2001 From: Nikolai Kostrigin Date: Tue, 10 Mar 2020 11:35:30 +0300 Subject: [PATCH] 40grub2: skip 30_os-prober section parsing to avoid cross system menu items --- linux-boot-probes/mounted/common/40grub2 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/linux-boot-probes/mounted/common/40grub2 b/linux-boot-probes/mounted/common/40grub2 index f747d0c..0e430ba 100755 --- a/linux-boot-probes/mounted/common/40grub2 +++ b/linux-boot-probes/mounted/common/40grub2 @@ -11,6 +11,7 @@ found_item=0 entry_result () { if [ "$ignore_item" = 0 ] && \ + [ "$ignore_section" = 0 ] && \ [ -n "$kernel" ] && \ [ -e "$mpoint/$kernel" ]; then result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" @@ -96,6 +97,24 @@ parse_grub_menu () { "}") entry_result ;; + "###") + # sections are delimited with triple octothorpe + # avoid parsing 30_linux section of grub.cfg + # as there is no good to mess with intersystem + # boot menu items provided there + if [ "$4" = "###" ] && [ "$(echo "$3" |grep "30_os-prober")" != "" ]; then + case "$2" in + BEGIN) + ignore_section=1 + debug "Skip 30_os-prober section: ON" + ;; + END) + ignore_section=0 + debug "Skip 30_os-prober section: OFF" + ;; + esac + fi + ;; esac done -- 2.25.1