fix: GRUB_DISTRIBUTION for buildd

LP: #2034253 Grub is found to use lsb_release or default to Debian.
buildd does not have lsb_release, so Debian was the GRUB_DISTRIBUTION.
that ends up with issues with the EFI path
This commit is contained in:
John Chittum 2023-09-07 13:52:38 -05:00
parent 59732bc789
commit 1184af06b0
No known key found for this signature in database
GPG Key ID: 42FD6DD37F7F195B

View File

@ -97,21 +97,12 @@ install_grub() {
# not called here as it calls snap-seed-parse, resulting in duplicate # not called here as it calls snap-seed-parse, resulting in duplicate
# snap listings) # snap listings)
chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages
# LP: 2034253
chroot mountpoint grub-install "${loop_device}" \ # awaiting grub updates, we need to set the Distributor _before_ running grub-install
--boot-directory=/boot \ # so that the EFI bits are in the correct place
--efi-directory=/boot/efi \ # buildd doesn't have `lsb_release`
--target=${efi_target} \ # so adding GRUB_DISTRIBUTOR, hardcoded to Ubuntu, for buildd for now
--uefi-secure-boot \ cat > mountpoint/etc/default/grub.d/50-builddimg-settings.cfg << EOF
--no-nvram
if [ "$ARCH" = "amd64" ]; then
# Install the BIOS/GPT bits. Since GPT boots from the ESP partition,
# it means that we just run this simple command and we're done
chroot mountpoint grub-install --target=i386-pc "${loop_device}"
fi
cat > mountpoint/etc/default/grub.d/50-builddimg-settings.cfg << EOF
GRUB_DEFAULT=0 GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0.1 GRUB_HIDDEN_TIMEOUT=0.1
GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_HIDDEN_TIMEOUT_QUIET=true
@ -119,7 +110,21 @@ GRUB_TIMEOUT=0.1
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0" GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"
GRUB_RECORDFAIL_TIMEOUT=0 GRUB_RECORDFAIL_TIMEOUT=0
GRUB_TERMINAL=console GRUB_TERMINAL=console
GRUB_DISTRIBUTOR=Ubuntu
EOF EOF
chroot mountpoint grub-install "${loop_device}" \
--boot-directory=/boot \
--efi-directory=/boot/efi \
--target=${efi_target} \
--uefi-secure-boot \
--no-nvram
if [ "$ARCH" = "amd64" ]; then
# Install the BIOS/GPT bits. Since GPT boots from the ESP partition,
# it means that we just run this simple command and we're done
chroot mountpoint grub-install --target=i386-pc "${loop_device}"
fi
divert_grub mountpoint divert_grub mountpoint
chroot mountpoint update-grub chroot mountpoint update-grub