util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries
On systems which support multiple boot platforms such as BIOS and EFI, it makes no sense to show menu entries which are not supported by the current boot platform. Menu entries generated from os-prober "chain" boot type use boot sector chainloading which is supported on PC BIOS platform only. Show "chain" menu entries only if boot platform is PC BIOS. Show "efi" menu entries only if boot platform is EFI. This is aimed to allow os-prober to report both EFI and PC BIOS boot loaders regardless of the current boot mode on x86 systems which support both EFI and legacy BIOS boot, in order to generate a config file which can be used with either BIOS or EFI boot. Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
56ccc5ed56
commit
fbcc388917
@ -162,6 +162,8 @@ for OS in ${OSPROBED} ; do
|
|||||||
|
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
# This menu entry is supported only on PC BIOS platforms.
|
||||||
|
if [ "\$grub_platform" = "pc" ]; then
|
||||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
||||||
EOF
|
EOF
|
||||||
save_default_entry | grub_add_tab
|
save_default_entry | grub_add_tab
|
||||||
@ -186,6 +188,7 @@ EOF
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
chainloader +1
|
chainloader +1
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
efi)
|
efi)
|
||||||
@ -194,6 +197,8 @@ EOF
|
|||||||
DEVICE=${DEVICE%@*}
|
DEVICE=${DEVICE%@*}
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
# This menu entry is supported only on EFI platforms.
|
||||||
|
if [ "\$grub_platform" = "efi" ]; then
|
||||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
|
||||||
EOF
|
EOF
|
||||||
save_default_entry | sed -e "s/^/\t/"
|
save_default_entry | sed -e "s/^/\t/"
|
||||||
@ -202,6 +207,7 @@ EOF
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
chainloader ${EFIPATH}
|
chainloader ${EFIPATH}
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
linux)
|
linux)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user