From 06defc43482fabbc48c5e3a5a14ec3bbe60d26a5 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Wed, 19 Jul 2023 15:05:27 +0530 Subject: [PATCH] Use ubuntu-cloud-minimal metapackage in minimized CPC images Now that we have the cloud-minimal seed for minimized cloud image builds, we should drop all the workarounds and hacks we once needed when we were using the server seed. We can directly use the new metapackage and get rid of the tasks and other autoremoves, et al. --- live-build/auto/config | 9 ++++-- .../hooks.d/chroot/999-cpc-fixes.chroot | 31 ------------------- 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index f881cc87..b5c722a4 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1109,8 +1109,7 @@ case $PROJECT in KERNEL_FLAVOURS=virtual if [ "${SUBPROJECT:-}" = minimized ]; then - add_task install cloud-image - add_package install sudo lxd-installer + add_package install ubuntu-cloud-minimal else add_task install minimal standard cloud-image add_package install ubuntu-minimal @@ -1210,7 +1209,11 @@ case $PROJECT:${SUBPROJECT:-} in BASE_SEED='wsl' ;; ubuntu-cpc:*) - BASE_SEED='server' + # we don't preseed any snaps in minimized images, so no need to set + # BASE_SEED in that case. + if [ "${SUBPROJECT:-}" != minimized ]; then + BASE_SEED='server' + fi ;; ubuntu-server:live) BASE_SEED='server' diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot index 9a25c0a0..6d7b62ea 100755 --- a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot @@ -91,37 +91,6 @@ if [ -L "${rootd}/boot/initrd.img" ] && [ ! -e "${rootd}/boot/initrd.img" ]; the rm "${rootd}/boot/initrd.img" fi -# Recommends of ubuntu-server that should not be included in cloud images by -# default -# unfortunately because we are currently installing ubuntu-server as a task, -# all of the recursive dependencies are marked as manually installed and are -# not subject to autoremoval. There is discussion of us stopping the use of -# tasks in livecd-rootfs but in the meantime, we have to also explicitly -# remove the packages providing the services -_xchroot "$rootd" env DEBIAN_FRONTEND=noninteractive \ - apt-get -y autoremove --purge fwupd modemmanager udisks2 - -if [ "${SUBPROJECT:-}" = minimized ]; then - # Remove various packages that we don't want in the minimized images. - # Some of these are tools that don't make sense by default - # non-interactively; some are libraries whose reverse-dependencies - # will have already been removed; open-vm-tools, it's a bug that this - # is in the common cloud seed because this should only be included - # in VMWare guest images, and we know none of the minimized images - # are targeted at VMWare. - _xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \ - apt-mark auto '^lib.*' '^python*' vim-runtime 2>/dev/null - # FIXME: iso-codes is a dep of software-properties and shouldn't be - _xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \ - apt-get -y autoremove --purge iso-codes xauth pastebinit \ - plymouth open-vm-tools git git-man shared-mime-info vim vim-common \ - console-setup ncurses-term tmux screen policykit-1 \ - xdg-user-dirs less publicsuffix run-one apport-symptoms \ - ubuntu-cloudimage-keyring file - - _xchroot "${rootd}" apt clean -fi - #### END COMMON ARCH FUNCTIONS