diff --git a/debian/changelog b/debian/changelog index 33233a26..41b3beda 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,10 @@ livecd-rootfs (2.541) UNRELEASED; urgency=medium * Remove device nodes from Docker images. (LP: #1645468) + [ Robert C Jennings ] + * Add the server snap seed to the ubuntu-cpc project + * Allow hooks to replace generic snap assertion + -- Michael Hudson-Doyle Wed, 26 Sep 2018 12:43:23 +1200 livecd-rootfs (2.540) cosmic; urgency=medium diff --git a/live-build/auto/config b/live-build/auto/config index fd2ce64d..5ab67fac 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -696,6 +696,9 @@ case $PROJECT:${SUBPROJECT:-} in ubuntu:*|kubuntu*:*|lubuntu*:*|xubuntu*:*|ubuntu-mate*:*|ubuntustudio*:*|ubuntukylin*:*|ubuntu-budgie*:*) BASE_SEED='desktop' ;; + ubuntu-cpc:*) + BASE_SEED='server' + ;; ubuntu-server:live) BASE_SEED='server' # subiquity is seeded but in a separate squashfs via hooks; set HOOK_SNAPS and ALL_SNAPS. diff --git a/live-build/functions b/live-build/functions index 4441f2b1..cf68ba16 100644 --- a/live-build/functions +++ b/live-build/functions @@ -427,6 +427,16 @@ snap_prepare_assertions() { local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)" local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)" + # Clear the assertions if they already exist + if [ -e "$model_assertion" ] ; then + existing_model=$(awk '/^model: / {print $2}' $model_assertion) + existing_brand=$(awk '/^brand-id: / {print $2}' $model_assertion) + echo "snap_prepare_assertions: replacing $existing_brand:$existing_model with $brand:$model" + rm "$model_assertion" + rm "$account_key_assertion" + rm "$account_assertion" + fi + if ! [ -e "$model_assertion" ] ; then snap known --remote model series=16 \ model=$model brand-id=$brand \ @@ -441,7 +451,6 @@ snap_prepare_assertions() { > "$account_key_assertion" fi - if ! [ -e "$account_assertion" ] ; then local account=$(sed -n -e's/account-id: //p' < "$account_key_assertion") snap known --remote account account-id=$account \ @@ -468,13 +477,16 @@ snap_prepare() { } snap_preseed() { - # Preseed a snap in the image + # Preseed a snap in the image (snap_prepare must be called once prior) local CHROOT_ROOT=$1 local SNAP=$2 # Per Ubuntu policy, all seeded snaps (with the exception of the core # snap) must pull from stable/ubuntu-$(release_ver) as their channel. local CHANNEL=${3:-"stable/ubuntu-$(release_ver)"} - snap_prepare $CHROOT_ROOT + if [ ! -e "$CHROOT_ROOT/var/lib/snapd/seed/assertions/model" ]; then + echo "ERROR: Snap model assertion not present, snap_prepare must be called" + exit 1 + fi _snap_preseed $CHROOT_ROOT $SNAP $CHANNEL }