From c60bd6f2cfcd6ad59bd2b10aa6da01ece4700f09 Mon Sep 17 00:00:00 2001 From: CloudBuilder Date: Thu, 25 Jul 2019 20:47:05 +0000 Subject: [PATCH] Imported 2.525.28 No reason for CPC update specified. --- debian/changelog | 16 ++++++++++++++++ debian/control | 2 +- live-build/functions | 29 ++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index b2c046ef..40233f6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +livecd-rootfs (2.525.28) bionic; urgency=medium + + [ Tobias Koch ] + * Do proper error checking when calling snap-tool info to determine + the base of a snap. (LP: #1828500) + + [ Michael Vogt ] + * Run "snap debug validate-seed" during preseeding to do basic validation of + the generated seed.yaml + + [ Iain Lane ] + * Seed core for non minimized builds, as it is still required (LP: + #1836594). + + -- Iain Lane Tue, 16 Jul 2019 13:20:18 +0100 + livecd-rootfs (2.525.27) bionic; urgency=medium * Backport improvements to snap seeding from trunk. LP: #1831675. diff --git a/debian/control b/debian/control index 6358738e..5ea1443b 100644 --- a/debian/control +++ b/debian/control @@ -33,7 +33,7 @@ Depends: ${misc:Depends}, python3-software-properties, qemu-utils, rsync, - snapd, + snapd (>= 2.39), squashfs-tools (>= 1:3.3-1), sudo, u-boot-tools [armhf arm64], diff --git a/live-build/functions b/live-build/functions index cf4509f9..a3e5b2fd 100644 --- a/live-build/functions +++ b/live-build/functions @@ -445,12 +445,20 @@ _snap_preseed() { ;; *) # Determine if and what core snap is needed - local core_snap=$(/usr/share/livecd-rootfs/snap-tool info \ + local snap_info + + snap_info=$(/usr/share/livecd-rootfs/snap-tool info \ --cohort-key="${COHORT_KEY:-}" \ - --channel="$CHANNEL" "$SNAP_NAME" | \ - grep '^base:' | awk '{print $2}' + --channel="$CHANNEL" "${SNAP_NAME}" \ ) + if [ $? -ne 0 ]; then + echo "Failed to retrieve base of $SNAP_NAME!" + exit 1 + fi + + local core_snap=$(echo "$snap_info" | grep '^base:' | awk '{print $2}') + # If $core_snap is not the empty string then SNAP itself is not a core # snap and we must additionally seed the core snap. if [ -n "$core_snap" ]; then @@ -550,6 +558,12 @@ snap_prepare() { local snaps_dir="$seed_dir/snaps" snap_prepare_assertions "$CHROOT_ROOT" "$CUSTOM_BRAND_MODEL" + + # ubuntu-cpc:minimized has its own special snap handling + if [ "$PROJECT:${SUBPROJECT:-}" != ubuntu-cpc:minimized ]; then + # Download the core snap + _snap_preseed "$CHROOT_ROOT" core stable + fi } snap_preseed() { @@ -571,6 +585,15 @@ snap_preseed() { touch "$CHROOT_ROOT/var/lib/snapd/seed/.snapd-explicit-install-stamp" ;; esac + + + # Do basic validation of generated snapd seed.yaml, doing it here + # means we catch all the places(tm) that snaps are added but the + # downside is that each time a snap is added the seed must be valid, + # i.e. snaps with bases need to add bases first etc. + if [ -e chroot/var/lib/snapd/seed/seed.yaml ]; then + snap debug validate-seed "$CHROOT_ROOT/var/lib/snapd/seed/seed.yaml" + fi } is_live_layer () {