[Merge] ~tobijk/livecd-rootfs/+git/livecd-rootfs:feature/implicit-core-seeding into livecd-rootfs:ubuntu/master
Steve Langasek
steve.langasek at canonical.com
Fri Apr 12 20:31:33 UTC 2019
Review: Approve
Diff comments:
> diff --git a/live-build/auto/config b/live-build/auto/config
> index 89519ae..46246eb 100755
> --- a/live-build/auto/config
> +++ b/live-build/auto/config
> @@ -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
Interesting, I usually just write ':> config/seeded-snaps' :)
> +fi
>
> # grab a list of packags to remove for a "minimal" installation from the seed
> # mirror for this project
> diff --git a/live-build/functions b/live-build/functions
> index c0dfcdc..ad6eca7 100644
> --- a/live-build/functions
> +++ b/live-build/functions
> @@ -416,6 +416,47 @@ inheritance () {
> echo "$inherit"
> }
>
> +_snap_post_process() {
> + # Look for the 'core' snap. If it is not present, assume that the image
> + # contains only snaps with bases >= core18. In that case snapd is
> + # preseeded. However, when 'core' is being installed and snapd has not
> + # been installed by a call to 'snap_preseed' (see below) then it is
> + # removed again.
> + local CHROOT_ROOT=$1
> + local SNAP_NAME=$2
> +
> + local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
> + local snaps_dir="$seed_dir/snaps"
> + local seed_yaml="$seed_dir/seed.yaml"
> + local assertions_dir="$seed_dir/assertions"
> + local snapd_install_stamp="$seed_dir/.snapd-explicit-install-stamp"
> +
> + case $SNAP_NAME in
> + core[0-9]*)
> + # If the 'core' snap is not present, assume we are coreXX-only and
> + # install the snapd snap.
> + if [ ! -f ${snaps_dir}/core_[0-9]*.snap ]; then
> + _snap_preseed $CHROOT_ROOT snapd stable
> + fi
> + ;;
> + core)
> + # If the snapd snap has been seeded, but not marked as explicitly
> + # installed (see snap_preseed below), then remove it.
> + if [ -f ${snaps_dir}/snapd_[0-9]*.snap ] && \
> + [ ! -f "$snapd_install_stamp" ]
> + then
> + # Remove snap, assertions and entry in seed.yaml
> + rm -f ${snaps_dir}/snapd_[0-9]*.snap
> + rm -f ${assertions_dir}/snapd_[0-9]*.assert
> + sed --in-place -E 'N;/name: snapd/,+2d' $seed_yaml
-i is more idiomatic than --in-place.
-E is unnecessary, there are no extended regexps here.
the use of the N command is also unnecessary.
I will fix this up to (what I consider idiomatic):
sed -i -e'/name: snapd/,+2d' $seed_yaml
> + fi
> + ;;
> + *)
> + # ignore
> + ;;
> + esac
> +}
> +
> _snap_preseed() {
> # Download the snap/assertion and add to the preseed
> local CHROOT_ROOT=$1
--
https://code.launchpad.net/~tobijk/livecd-rootfs/+git/livecd-rootfs/+merge/365878
Your team Ubuntu Core Development Team is subscribed to branch livecd-rootfs:ubuntu/master.
More information about the Ubuntu-reviews
mailing list