apply dpkg minimizations to minimal layer, and undo them for full layer

impish-sru-lp-1946520
Michael Hudson-Doyle 3 years ago
parent 5232f2f8cc
commit 5fda0bb2aa

@ -169,7 +169,10 @@ Expire-Date: 0
rm -f chroot/etc/localtime chroot/etc/timezone rm -f chroot/etc/localtime chroot/etc/timezone
fi 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 # set up dpkg filters to skip installing docs on minimized system
mkdir -p chroot/etc/dpkg/dpkg.cfg.d mkdir -p chroot/etc/dpkg/dpkg.cfg.d
cat > chroot/etc/dpkg/dpkg.cfg.d/excludes <<EOF cat > chroot/etc/dpkg/dpkg.cfg.d/excludes <<EOF
@ -278,7 +281,7 @@ if dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-server 2> /dev/
fi fi
EOF EOF
fi fi
if [ "$PROJECT" = "ubuntu-cpc" ]; then if [ "$PROJECT" = "ubuntu-cpc" ] || [ "$PROJECT" = "ubuntu-server" ]; then
cat >> chroot/usr/local/sbin/unminimize <<'EOF' cat >> chroot/usr/local/sbin/unminimize <<'EOF'
echo "Removing lxd installer package..." echo "Removing lxd installer package..."

@ -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
Loading…
Cancel
Save