Do not include any snaps in ubuntu-cpc:minimized builds

snap-tool-base-none
Tobias Koch 6 years ago committed by Steve Langasek
parent 04e5864c51
commit 05e71b3840

15
debian/changelog vendored

@ -1,3 +1,18 @@
livecd-rootfs (2.577) UNRELEASED; urgency=medium
[ Tobias Koch ]
* Detect which core snaps are required and install them on-the-fly.
[ Michael Hudson-Doyle ]
* Slim down ubuntu-cpc:minimized builds:
- Do not include any snaps in ubuntu-cpc:minimized builds (erroring if any
snap other than lxd is seeded).
- Install the lxd-installer package instead, which installs the lxd snap
when invoked.
- Install lxd snap in unminimize.
-- Tobias Koch <tobias.koch@canonical.com> Thu, 11 Apr 2019 17:25:25 +0200
livecd-rootfs (2.576) disco; urgency=medium
* When the "snap-tool" script encounters a core snap it will switch to

@ -226,7 +226,17 @@ if dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-server 2> /dev/
fi
EOF
fi
cat >> chroot/usr/local/sbin/unminimize <<'EOF'
if [ "$PROJECT" = "ubuntu-cpc" ]; then
cat >> chroot/usr/local/sbin/unminimize <<'EOF'
echo "Removing lxd installer package..."
apt-get purge -y lxd-installer
echo "Installing lxd from snap..."
snap install lxd
EOF
fi
cat >> chroot/usr/local/sbin/unminimize <<'EOF'
# unminimization succeeded, there is no need to mention it in motd
rm -f /etc/update-motd.d/60-unminimize

@ -807,7 +807,7 @@ case $PROJECT in
ubuntu-cpc)
if [ "${SUBPROJECT:-}" = minimized ]; then
add_task install cloud-image
add_package install sudo
add_package install sudo lxd-installer
# linux-kvm currently only exists for amd64, so fall back to the
# virtual flavour for other architectures
if [ "$ARCH" = "amd64" ]; then
@ -896,6 +896,25 @@ esac
if [ "$PASSES_TO_LAYERS" != "true" ] && [ -n "${BASE_SEED}" ]; then
snap_from_seed "${BASE_SEED}" config/seeded-snaps
fi
if [ "$PROJECT:${SUBPROJECT:-}" = ubuntu-cpc:minimized ]; then
# We install a lxc script that installs the snap when invoked. We don't
# want any other snaps to come in without due consideration, so fail the
# build if we see such a snap.
for snap in `cat config/seeded-snaps`; do
case $snap in
lxd)
;;
*)
echo "Unexpected seeded snap for ubuntu-cpc:minimized build: $snap"
exit 1
;;
esac
done
# Truncate but don't delete to a) prevent any snaps from being seeded,
# while at the same time b) triggering initialization of assertions.
truncate --size 0 config/seeded-snaps
fi
# grab a list of packags to remove for a "minimal" installation from the seed
# mirror for this project

@ -436,6 +436,17 @@ _snap_preseed() {
return
fi
# Determine if and what core snap is needed
local core_snap=$(/usr/share/livecd-rootfs/snap-tool info \
--cohort-key="${COHORT_KEY:-}" \
--channel="$CHANNEL" "$SNAP_NAME" | \
grep '^base:' | awk '{print $2}'
)
if [ -n "$core_snap" ]; then
_snap_preseed $CHROOT_ROOT $core_snap stable
fi
sh -c "
set -x;
cd \"$CHROOT_ROOT/var/lib/snapd/seed\";
@ -544,9 +555,6 @@ snap_prepare() {
local CUSTOM_BRAND_MODEL=${2:-generic:generic-classic}
snap_prepare_assertions "$CHROOT_ROOT" "$CUSTOM_BRAND_MODEL"
# Download the core snap
_snap_preseed $CHROOT_ROOT core stable
}
snap_preseed() {

Loading…
Cancel
Save