diff -Nru livecd-rootfs-2.525.27/debian/changelog livecd-rootfs-2.525.28/debian/changelog --- livecd-rootfs-2.525.27/debian/changelog 2019-06-10 17:46:16.000000000 +0000 +++ livecd-rootfs-2.525.28/debian/changelog 2019-07-16 12:20:18.000000000 +0000 @@ -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 -Nru livecd-rootfs-2.525.27/debian/control livecd-rootfs-2.525.28/debian/control --- livecd-rootfs-2.525.27/debian/control 2019-06-10 17:46:03.000000000 +0000 +++ livecd-rootfs-2.525.28/debian/control 2019-07-16 12:20:18.000000000 +0000 @@ -33,7 +33,7 @@ python3-software-properties, qemu-utils, rsync, - snapd, + snapd (>= 2.39), squashfs-tools (>= 1:3.3-1), sudo, u-boot-tools [armhf arm64], diff -Nru livecd-rootfs-2.525.27/live-build/functions livecd-rootfs-2.525.28/live-build/functions --- livecd-rootfs-2.525.27/live-build/functions 2019-06-10 17:46:03.000000000 +0000 +++ livecd-rootfs-2.525.28/live-build/functions 2019-07-16 12:20:18.000000000 +0000 @@ -445,12 +445,20 @@ ;; *) # 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 @@ 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 @@ 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 () {