From 5fda0bb2aa07b4c7bf3cd0537654a1304235c0b0 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 21 Jul 2021 14:54:30 +1200 Subject: [PATCH] apply dpkg minimizations to minimal layer, and undo them for full layer --- live-build/auto/build | 7 +++++-- .../hooks/01-unminimize.chroot_early | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100755 live-build/ubuntu-server/hooks/01-unminimize.chroot_early diff --git a/live-build/auto/build b/live-build/auto/build index e1a00f88..3133972b 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -169,7 +169,10 @@ Expire-Date: 0 rm -f chroot/etc/localtime chroot/etc/timezone fi - if [ "${SUBPROJECT:-}" = minimized ]; then + if [ "${SUBPROJECT:-}" = minimized ] || [ "${PROJECT}" = "ubuntu-server" ]; then + # ubuntu-server has a minimized base layer so needs + # minimizations applied to the chroot + # set up dpkg filters to skip installing docs on minimized system mkdir -p chroot/etc/dpkg/dpkg.cfg.d cat > chroot/etc/dpkg/dpkg.cfg.d/excludes < /dev/ fi EOF fi - if [ "$PROJECT" = "ubuntu-cpc" ]; then + if [ "$PROJECT" = "ubuntu-cpc" ] || [ "$PROJECT" = "ubuntu-server" ]; then cat >> chroot/usr/local/sbin/unminimize <<'EOF' echo "Removing lxd installer package..." diff --git a/live-build/ubuntu-server/hooks/01-unminimize.chroot_early b/live-build/ubuntu-server/hooks/01-unminimize.chroot_early new file mode 100755 index 00000000..f70b59b4 --- /dev/null +++ b/live-build/ubuntu-server/hooks/01-unminimize.chroot_early @@ -0,0 +1,20 @@ +#!/bin/bash + +set -ex + +case ${PASS} in + ubuntu-server-minimal.ubuntu-server) + ;; + *) + exit 0 + ;; +esac + +# The unminimize script will try to install the lxd snap. We can't +# do that at this stage so just neuter the snap command (the snap +# will get properly seeded by generic machinery). +dpkg-divert --add --divert /usr/bin/snap.REAL --rename /usr/bin/snap +ln -s /bin/true /usr/bin/snap +yes | /usr/local/sbin/unminimize +rm /usr/bin/snap +dpkg-divert --remove --rename /usr/bin/snap