2018-10-23 10:20:53 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-10-09 09:11:56 +00:00
|
|
|
# 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
|
|
|
|
|
2018-10-23 10:20:53 +00:00
|
|
|
ARCH=$(uname -m)
|
|
|
|
|
2019-10-09 09:11:56 +00:00
|
|
|
# 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
|
2018-10-23 10:20:53 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
[[ -f /etc/default/grub ]] && . /etc/default/grub
|
|
|
|
|
|
|
|
COMMAND="$1"
|
|
|
|
|
|
|
|
case "$COMMAND" in
|
|
|
|
add|remove)
|
2019-02-26 07:35:22 +00:00
|
|
|
grub2-mkconfig --no-grubenv-update -o /boot/grub2/grub.cfg >& /dev/null
|
2018-10-23 10:20:53 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|