From 3397098ff833c2c8b97911a37d7a552c1c2e4236 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Mon, 12 Jun 2023 15:11:36 -0600 Subject: [PATCH] Allow choosing snap channel on subiquity ISOs --- live-build/auto/config | 8 +++++++- live-build/ubuntu/hooks/020-canary-enhanced-sb.binary | 7 ++++++- live-build/ubuntu/hooks/020-canary-live.binary | 7 ++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 1e458161..eb0d98de 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -189,8 +189,13 @@ add_snap () _check_immutable_passes_to_layers _register_pass "$pass" + local channel="" + if [ -n "$CHANNEL" ] ; then + channel="=$CHANNEL" + fi + for pkg; do - echo "$pkg" >> "config/package-lists/livecd-rootfs.snaplist.chroot_$pass.full" + echo "$pkg$channel" >> "config/package-lists/livecd-rootfs.snaplist.chroot_$pass.full" done } @@ -1339,6 +1344,7 @@ echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary echo "BUILDSTAMP=\"$NOW\"" >> config/binary echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/binary +echo "CHANNEL=\"${CHANNEL:-}\"" >> config/binary if [ "${IMAGE_HAS_HARDCODED_PASSWORD:-}" = "1" ]; then echo IMAGE_HAS_HARDCODED_PASSWORD=1 >> config/binary diff --git a/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary b/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary index 3083e3dc..befa36ec 100644 --- a/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary +++ b/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary @@ -107,7 +107,12 @@ Ekm0W8qT4AT0GSk5CY8kx+UvCn6FLxMuv8xjWoX3OLcQx31yO6Uy6c2LN6nSlovDghKP5V1KvlKl WiXM9CPKCZv/Es3uOp/ke0wWL7v0MZhzUJ+QhOtTNg== EOF -env SNAPPY_STORE_NO_CDN=1 snap prepare-image --classic config/classic-model.model chroot +channel="" +if [ -n "$CHANNEL" ]; then + channel="--channel $CHANNEL" +fi +env SNAPPY_STORE_NO_CDN=1 snap prepare-image \ + --classic config/classic-model.model $channel chroot mv chroot/system-seed/systems/* chroot/system-seed/systems/enhanced-secureboot-desktop rsync -a chroot/system-seed/ chroot/var/lib/snapd/seed rm -rf chroot/system-seed/ diff --git a/live-build/ubuntu/hooks/020-canary-live.binary b/live-build/ubuntu/hooks/020-canary-live.binary index f7fe266b..d3582a95 100755 --- a/live-build/ubuntu/hooks/020-canary-live.binary +++ b/live-build/ubuntu/hooks/020-canary-live.binary @@ -63,7 +63,12 @@ oPijs/y+KJ4DbdrmiwwWCxQZcx2T5GG4HB38eIsnmEWTyml02lOL9sWq6qKuk95a3DhF+Q02+zkG c3kEHr8kcSEkJtgwre/RjjlvGYhur1rZ4i0G6gGBLw== EOF -env SNAPPY_STORE_NO_CDN=1 snap prepare-image --classic config/classic-model-installer.model chroot +channel="" +if [ -n "$CHANNEL" ]; then + channel="--channel $CHANNEL" +fi +env SNAPPY_STORE_NO_CDN=1 snap prepare-image \ + --classic config/classic-model-installer.model $channel chroot mv chroot/system-seed/systems/* chroot/system-seed/systems/classic-installer rsync -a chroot/system-seed/ chroot/var/lib/snapd/seed rm -rf chroot/system-seed/