From 0109d5304e393f8a5e33f3f8e9f7582785f69836 Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 28 Apr 2017 22:30:18 +0200 Subject: [PATCH] Optionally use ubuntu-image for building snap based images --- debian/control | 5 ++++- live-build/auto/build | 6 ++++++ live-build/auto/config | 29 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 4f19c174..9ecc7dbe 100644 --- a/debian/control +++ b/debian/control @@ -23,7 +23,10 @@ Depends: ${misc:Depends}, python-minimal | python, python3-software-properties, rsync, - squashfs-tools (>= 1:3.3-1) + snapd, + squashfs-tools (>= 1:3.3-1), + sudo, + ubuntu-image Suggests: partimage Breaks: ubuntu-defaults-builder (<< 0.32) Description: construction script for the livecd rootfs diff --git a/live-build/auto/build b/live-build/auto/build index 5451f42a..cfe00bdd 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -15,6 +15,12 @@ if [ -z "${PROJECT:-}" ]; then exit 1 fi +if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then + # Use ubuntu-image instead of live-build + env SNAPPY_STORE_NO_CDN=1 ubuntu-image -o livecd."$PROJECT".img livecd."$PROJECT".model-assertion + exit 0 +fi + # Setup cleanup function Setup_cleanup diff --git a/live-build/auto/config b/live-build/auto/config index 4f1feb52..2f8decec 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -147,6 +147,35 @@ case $IMAGEFORMAT in esac ;; + ubuntu-image) + case "$ARCH+${SUBARCH:-}" in + amd64+*) + MODEL=pc-amd64 ;; + i386+*) + MODEL=pc-i386 ;; + arm64+snapdragon) + MODEL=dragonboard ;; + armhf+raspi2) + MODEL=pi2 ;; + armhf+raspi3) + MODEL=pi3 ;; + *) + echo "Model $ARCH+${SUBARCH:-} unknown to livecd-rootfs" >&2 + exit 1 + ;; + esac + echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common + # Store model assertion in top dir to get it picked up later as a build artifact + env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > livecd."$PROJECT".model-assertion + echo "Configured ubuntu-image for the following model assertion:" + cat livecd."$PROJECT".model-assertion + echo "----------------------------------------------------------" + # Fake finished configuration for lb build + mkdir -p .build + touch .build/config + exit 0 + ;; + *) case $PROJECT in ubuntu-server|ubuntu-touch|ubuntu-touch-custom)