grub2/99-grub-mkconfig.install
Javier Martinez Canillas 35ccd46253
99-grub-mkconfig: Fix script condition to exit and remove ppc64 BE check
The ppc64 big endian support ended in F29 and only ppc64le is supported so
there's no need to check for this architecture.

Also the script wasn't properly tested and the check for Xen DomU machines
isn't correct. Fix the test condition to exit the script.

Related: rhbz#1703700

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2019-10-10 09:15:46 +02:00

39 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
RUN_MKCONFIG=true
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)
if [[ $ARCH = "ppc64le" ]]; then
RUN_MKCONFIG=true
fi
# 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 [[ $RUN_MKCONFIG != "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