From f7fcac1602dd46181ec09e1bf4256c6255b23b50 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Tue, 31 Oct 2017 09:58:35 -0700 Subject: [PATCH] Import patches-unapplied version 2.479 to ubuntu/bionic-proposed Imported using git-ubuntu import. Changelog parent: 9f966299f1d8e3303a98ce3b63479afd708c16ee New changelog entries: * Purge initramfs-tools from minimized images. * Make sure to remove any initramfs that was generated in a minimized image. * divert /usr/bin/systemd-detect-virt as part of the grub diversions, so that the grub kernel postinst hook is operational when we're building in a container. LP: #1729034. --- debian/changelog | 11 +++++++++++ live-build/auto/build | 21 +++++++++++++++++++++ live-build/functions | 13 +++++++++++++ 3 files changed, 45 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6cff81ff..444bcf00 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +livecd-rootfs (2.479) bionic; urgency=medium + + * Purge initramfs-tools from minimized images. + * Make sure to remove any initramfs that was generated in a minimized + image. + * divert /usr/bin/systemd-detect-virt as part of the grub diversions, so + that the grub kernel postinst hook is operational when we're building + in a container. LP: #1729034. + + -- Steve Langasek Tue, 31 Oct 2017 09:58:35 -0700 + livecd-rootfs (2.478) artful; urgency=medium [ Michael Hudson-Doyle ] diff --git a/live-build/auto/build b/live-build/auto/build index 41c21337..e2d9359e 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -210,6 +210,27 @@ EOF lb chroot "$@" + if [ "${SUBPROJECT:-}" = minimized ]; then + # force removal of initramfs-tools, which we assert is not + # required for any minimized images but is still pulled in by + # default + Chroot chroot "env DEBIAN_FRONTEND=noninteractive \ + apt-get -y purge initramfs-tools busybox-initramfs \ + busybox-static" + # and if initramfs-tools was configured before our kernel, + # /etc/kernel/postinst.d/initramfs-tools will have created + # an initramfs despite the generic dpkg-divert; so remove it + # here. + rm -f chroot/boot/initrd.img-* + + # temporary workaround: don't remove linux-base which + # may have no other reverse-depends currently + Chroot chroot "env DEBIAN_FRONTEND=noninteractive \ + apt-mark manual linux-base" + Chroot chroot "env DEBIAN_FRONTEND=noninteractive \ + apt-get -y --purge autoremove" + fi + if [ -f config/oem-config-preinstalled ]; then # This is cargo-culted almost verbatim (with some syntax changes for diff --git a/live-build/functions b/live-build/functions index f05aaf8e..549f3be3 100644 --- a/live-build/functions +++ b/live-build/functions @@ -300,6 +300,15 @@ divert_grub() { chroot "$CHROOT_ROOT" dpkg-divert --local \ --divert /etc/grub.d/30_os-prober.dpkg-divert \ --rename /etc/grub.d/30_os-prober + + # Divert systemd-detect-virt; /etc/kernel/postinst.d/zz-update-grub + # no-ops if we are in a container, and the launchpad farm runs builds + # in lxd. We therefore pretend that we're never in a container (by + # exiting 1). + chroot "$CHROOT_ROOT" dpkg-divert --local \ + --rename /usr/bin/systemd-detect-virt + echo "exit 1" > "$CHROOT_ROOT"/usr/bin/systemd-detect-virt + chmod +x "$CHROOT_ROOT"/usr/bin/systemd-detect-virt } undivert_grub() { @@ -312,4 +321,8 @@ undivert_grub() { chroot "$CHROOT_ROOT" dpkg-divert --remove --local \ --divert /etc/grub.d/30_os-prober.dpkg-divert \ --rename /etc/grub.d/30_os-prober + + rm "$CHROOT_ROOT"/usr/bin/systemd-detect-virt + chroot "$CHROOT_ROOT" dpkg-divert --remove --local \ + --rename /usr/bin/systemd-detect-virt }