mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 15:46:53 +00:00
aa81bb84d3
GRUB is used to boot Xen Dom0 hosts so BLS is supported there, but PV and PVH Xen DomU guests are booted with pygrub that doesn't have BLS support. This means that only HVM Xen DomU guests can support BLS and others need a traditional GRUB configuration file that contains menuentry commands. So to make the GRUB config compatible with all Xen DomU guests, don't use the BLS snippets and instead call grub2-mkconfig to regenerate the config on each kernel install and removal. Even when HVM Xen DomU guests can support BLS, just disable for all DomU so the configuration is consistent across all Xen DomU guests variants. And also because even when an installation is made with HVM, this can be later changed to a DomU variant that uses pygrub and doesn't support BLS. Resolves: rhbz#1703700 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Tested-by: Steven Haigh <netwiz@crc.id.au>
36 lines
1 KiB
Bash
Executable file
36 lines
1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
# A "control_d" string in /proc/xen/capabilities indicates that is a Xen Dom0 host.
|
|
[[ -e /sys/hypervisor/type ]] && read HV_TYPE < /sys/hypervisor/type
|
|
[[ -e /proc/xen/capabilities ]] && grep -q "control_d" /proc/xen/capabilities && XEN_DOM0=true
|
|
|
|
if [[ $HV_TYPE = "xen" && $XEN_DOM0 != "true" ]]; then
|
|
if grep -q '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then
|
|
sed -i 's/^GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/' /etc/default/grub
|
|
fi
|
|
fi
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
# A traditional grub configuration file needs to be generated only for ppc64le and
|
|
# Xen DomU guests since we can't assume that bootloaders will be BLS capable there.
|
|
if [[ $ARCH != "ppc64" && $ARCH != "ppc64le" ]] ||
|
|
[[ $HV_TYPE = "xen" && $XEN_DOM0 = "true" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
[[ -f /etc/default/grub ]] && . /etc/default/grub
|
|
|
|
COMMAND="$1"
|
|
|
|
case "$COMMAND" in
|
|
add|remove)
|
|
grub2-mkconfig --no-grubenv-update -o /boot/grub2/grub.cfg >& /dev/null
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|