From 7981a08c2c7be42f7305fc5c2a4f5baed07620c0 Mon Sep 17 00:00:00 2001 From: Cody Shepherd Date: Thu, 13 Feb 2020 17:49:02 -0800 Subject: [PATCH] Install packages and perform dist-upgrade necessary for secure xenial bootable-buildd image --- .../buildd/hooks/02-disk-image-uefi.binary | 3 ++- .../hooks/52-linux-virtual-image.binary | 19 ++++++++++++++++--- .../includes.chroot/etc/network/interfaces | 12 ++++++++++++ .../etc/network/interfaces.d/.keep | 0 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 live-build/buildd/includes.chroot/etc/network/interfaces create mode 100644 live-build/buildd/includes.chroot/etc/network/interfaces.d/.keep diff --git a/live-build/buildd/hooks/02-disk-image-uefi.binary b/live-build/buildd/hooks/02-disk-image-uefi.binary index 65c52af3..4339abe6 100755 --- a/live-build/buildd/hooks/02-disk-image-uefi.binary +++ b/live-build/buildd/hooks/02-disk-image-uefi.binary @@ -64,7 +64,8 @@ install_grub() { efi_boot_dir="/boot/efi/EFI/BOOT" chroot mountpoint mkdir -p "${efi_boot_dir}" - if [ "${SUBPROJECT:-}" = minimized ] && [ -n "$partuuid" ]; then + #if [ "${SUBPROJECT:-}" = minimized ] && [ -n "$partuuid" ]; then + if [ -n "$partuuid" ]; then echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid.cfg fi diff --git a/live-build/buildd/hooks/52-linux-virtual-image.binary b/live-build/buildd/hooks/52-linux-virtual-image.binary index a0c64d75..6f5d5c0d 100755 --- a/live-build/buildd/hooks/52-linux-virtual-image.binary +++ b/live-build/buildd/hooks/52-linux-virtual-image.binary @@ -36,12 +36,24 @@ cleanup_linux_virtual() { } trap cleanup_linux_virtual EXIT -# Install dependencies env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \ update --assume-yes + +# Perform a dist-upgrade to pull in -security and other pockets env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \ - install -y lsb-release locales initramfs-tools busybox-initramfs \ - udev dbus netplan.io cloud-init openssh-server sudo snapd + dist-upgrade --assume-yes + +# Install dependencies +env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \ + install -y --install-recommends bind9 busybox-initramfs cloud-init dbus \ + ifupdown initramfs-tools locales lsb-release \ + openssh-server resolvconf sudo snapd udev + +# Enable console output +cat >> $mount_d/etc/default/grub.d/50-buildd-settings.cfg << EOF +${IMAGE_STR} +GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0" +EOF # Install a kernel divert_grub "$mount_d" @@ -49,6 +61,7 @@ env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \ install --assume-yes linux-image-virtual env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \ autoremove --purge --assume-yes + chroot "$mount_d" update-grub undivert_grub "$mount_d" diff --git a/live-build/buildd/includes.chroot/etc/network/interfaces b/live-build/buildd/includes.chroot/etc/network/interfaces new file mode 100644 index 00000000..bb161e72 --- /dev/null +++ b/live-build/buildd/includes.chroot/etc/network/interfaces @@ -0,0 +1,12 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# Source interfaces +# Please check /etc/network/interfaces.d before changing this file +# as interfaces may have been defined in /etc/network/interfaces.d +# See LP: #1262951 +source /etc/network/interfaces.d/*.cfg diff --git a/live-build/buildd/includes.chroot/etc/network/interfaces.d/.keep b/live-build/buildd/includes.chroot/etc/network/interfaces.d/.keep new file mode 100644 index 00000000..e69de29b