On systems which support both BIOS/legacy and EFI boot, it makes no sense to show menu entries for EFI bootloaders when booted in BIOS/legacy mode and show menu entries for BIOS/legacy boot loaders when booted in EFI mode.
Show 'chain' menu entries only if not booted in EFI mode. Show 'efi' menu entries only if booted in EFI mode. This will allow os-prober to report both EFI and BIOS legacy boot loaders regardless of the current boot mode on systems which support both EFI and BIOS/legacy boot. Note: I did not change indentation to keep the patch minimal. Signed-off-by: Pascal Hambourg <pas...@plouf.fr.eu.org> --- util/grub.d/30_os-prober.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 8e5cbb50e..a16f7549b 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -155,6 +155,7 @@ for OS in ${OSPROBED} ; do onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF +if [ "\$grub_platform" != "efi" ]; then menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | grub_add_tab @@ -179,6 +180,7 @@ EOF cat <<EOF chainloader +1 } +fi EOF ;; efi) @@ -187,6 +189,7 @@ EOF DEVICE=${DEVICE%@*} onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF +if [ "\$grub_platform" = "efi" ]; then menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | sed -e "s/^/\t/" @@ -195,6 +198,7 @@ EOF cat <<EOF chainloader ${EFIPATH} } +fi EOF ;; linux) -- 2.30.2 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel