Call grub2-switch-to-blscfg with explicit config
Grub detection of whether the image is an efi image is incorrect because it detects the host efi instead. This change ensures this isn't an issue by explicitly including the config file with --config-file /etc/grub2.cfg. The files /etc/grub2.cfg and /etc/grub2-efi.cfg are currently identical so this change assumes that grub2-efi-x64 doesn't need to be installed at this point just to have /etc/grub2-efi.cfg available. This script is bootloader related so this change also moves it to the bootloader element finalise phase since it is coupled with bootloader/finalise.d/50-bootloader. This change also makes /etc/default/grub changes conditional. Even though grub2-tools is install it appears that this file is missing on the base image. Change-Id: Idc557f29899afed6e43ca06010f008d49b059e2b Closes-Bug: #1957789
This commit is contained in:
@@ -6,7 +6,7 @@ fi
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
if [[ ! '9-stream' =~ ${DIB_RELEASE} ]]; then
|
if [[ $DISTRO_NAME != "centos" || $DIB_RELEASE != "9-stream" ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -24,10 +24,14 @@ fi
|
|||||||
# packages to do this. Another option again would be just to rename
|
# packages to do this. Another option again would be just to rename
|
||||||
# the exsiting .conf files.
|
# the exsiting .conf files.
|
||||||
|
|
||||||
# If this is already set, grub2-switch-to-blscfg will abort
|
install-packages -m bootloader grub-pc
|
||||||
sed -i 's/GRUB_ENABLE_BLSCFG=true//' /etc/default/grub
|
|
||||||
echo "--- /etc/default/grub dump ---"
|
if [[ -a /etc/default/grub ]]; then
|
||||||
cat /etc/default/grub
|
# If this is already set, grub2-switch-to-blscfg will abort
|
||||||
|
sed -i 's/GRUB_ENABLE_BLSCFG=true//' /etc/default/grub
|
||||||
|
echo "--- /etc/default/grub dump ---"
|
||||||
|
cat /etc/default/grub
|
||||||
|
fi
|
||||||
|
|
||||||
# Clear out the entries that came with the qcow2 image
|
# Clear out the entries that came with the qcow2 image
|
||||||
echo "--- Clearing BLS entries ---"
|
echo "--- Clearing BLS entries ---"
|
||||||
@@ -37,7 +41,7 @@ rm /boot/loader/entries/*.conf
|
|||||||
# This will regenerate /boot/loader/entries for the current
|
# This will regenerate /boot/loader/entries for the current
|
||||||
# machine-id. After this, grub2-mkconfig works as usual.
|
# machine-id. After this, grub2-mkconfig works as usual.
|
||||||
#
|
#
|
||||||
grub2-switch-to-blscfg
|
grub2-switch-to-blscfg --config-file /etc/grub2.cfg
|
||||||
echo "--- Show kernels ---"
|
echo "--- Show kernels ---"
|
||||||
grubby --info=ALL
|
grubby --info=ALL
|
||||||
|
|
||||||
Reference in New Issue
Block a user