diff --git a/live-build/buildd/hooks/02-disk-image-uefi.binary b/live-build/buildd/hooks/02-disk-image-uefi.binary index 44a7ff42..a90f19c7 100755 --- a/live-build/buildd/hooks/02-disk-image-uefi.binary +++ b/live-build/buildd/hooks/02-disk-image-uefi.binary @@ -53,6 +53,26 @@ LABEL=UEFI /boot/efi vfat defaults 0 1 EOF } + +divert_lsb_release() { + CHROOT_ROOT="$1" + chroot "$CHROOT_ROOT" dpkg-divert --local \ + --divert /usr/bin/lsb_release.dpkg-divert \ + --rename /usr/bin/lsb_release + echo "echo Ubuntu" > "$CHROOT_ROOT"/usr/bin/lsb_release + chmod +x "$CHROOT_ROOT"/usr/bin/lsb_release + +} + +undivert_lsb_release() { + CHROOT_ROOT="$1" + if grep -q "^echo Ubuntu$" "$CHROOT_ROOT"/usr/bin/lsb_release; then + rm "$CHROOT_ROOT"/usr/bin/lsb_release + fi + chroot "$CHROOT_ROOT" dpkg-divert --remove --local \ + --rename /usr/bin/lsb_release +} + install_grub() { mkdir mountpoint mount_partition "${rootfs_dev_mapper}" mountpoint @@ -69,7 +89,8 @@ install_grub() { fi chroot mountpoint apt-get -y update - + divert_lsb_release mountpoint + chroot mountpoint lsb_release # UEFI GRUB modules are meant to be used equally by Secure Boot and # non-Secure Boot systems. If you need an extra module not already # provided or run into "Secure Boot policy forbids loading X" problems, @@ -84,7 +105,7 @@ install_grub() { efi_target=arm-efi ;; amd64) - chroot mountpoint apt-get install -qqy grub-pc shim-signed + chroot mountpoint apt-get install -qqy grub-pc shim-signed python3-apt efi_target=x86_64-efi ;; esac @@ -121,10 +142,12 @@ GRUB_RECORDFAIL_TIMEOUT=0 GRUB_TERMINAL=console EOF + divert_grub mountpoint chroot mountpoint update-grub replace_grub_root_with_label mountpoint undivert_grub mountpoint + undivert_lsb_release mountpoint chroot mountpoint apt-get -y clean