#!/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