From 706685a5a24389ac79f9c0825cb461582f4880ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 4 Oct 2018 19:33:10 +0200 Subject: [PATCH 1/6] Backport support for building core images with ubuntu-image. --- debian/changelog | 10 +++++++++ debian/control | 1 + live-build/auto/build | 22 ++++++++++++++++++++ live-build/auto/config | 46 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) diff --git a/debian/changelog b/debian/changelog index d20a448a..7fcd4e53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +livecd-rootfs (2.408.38) UNRELEASED; urgency=medium + + * Backport support for building ubuntu-core images with ubuntu-image (using + IMAGEFORMAT=ubuntu-image). + * Decide what model assertion series to fetch depending on the suite. Use 16 + for xenial and 18 for other series (bionic+). This enables core18 image + builds. + + -- Łukasz 'sil2100' Zemczak Thu, 04 Oct 2018 19:30:17 +0200 + livecd-rootfs (2.408.37) xenial; urgency=medium * debian/dirs: add debian/dirs entry for empty includes.chroot dir diff --git a/debian/control b/debian/control index ab1cc33f..015b5987 100644 --- a/debian/control +++ b/debian/control @@ -30,6 +30,7 @@ Depends: ${misc:Depends}, python3-software-properties, qemu-utils, rsync, + snapd, squashfs-tools (>= 1:3.3-1), vmdk-stream-converter [amd64 i386], xz-utils, diff --git a/live-build/auto/build b/live-build/auto/build index 69d8d94d..57dd674e 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -10,6 +10,28 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults +if [ -z "${PROJECT:-}" ]; then + echo "PROJECT environment variable has to be set" >&2 + exit 1 +fi + +. config/functions + +# Link output files somewhere BuildLiveCD will be able to find them. +PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" + +if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then + # Use ubuntu-image instead of live-build + + CHANNEL="${CHANNEL:-edge}" + env SNAPPY_STORE_NO_CDN=1 \ + ubuntu-image -c "$CHANNEL" $UBUNTU_IMAGE_ARGS \ + -o "$PREFIX".img "$PREFIX".model-assertion + xz -0 -T4 "$PREFIX".img + mv seed.manifest "$PREFIX".manifest + exit 0 +fi + # Setup cleanup function Setup_cleanup diff --git a/live-build/auto/config b/live-build/auto/config index 2e7c2e25..9cb6a833 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -96,6 +96,7 @@ LIVE_TASK= PREINSTALLED=false PREINSTALL_POOL= PREINSTALL_POOL_SEEDS= +PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" CHROOT_HOOKS= BINARY_HOOKS= @@ -144,6 +145,51 @@ case $IMAGEFORMAT in PREINSTALLED=true ;; + 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 ;; + armhf+cm3) + MODEL=cm3 ;; + *) + echo "Model $ARCH+${SUBARCH:-} unknown to livecd-rootfs" >&2 + exit 1 + ;; + esac + case $MODEL in + pc-amd64|pc-i386) + UBUNTU_IMAGE_ARGS="--image-size 3700M" ;; + *) + UBUNTU_IMAGE_ARGS="" ;; + esac + case $SUITE in + xenial) + CORE_SERIES=16 ;; + *) + CORE_SERIES=18 ;; + esac + + echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common + echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> 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=$CORE_SERIES model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion + echo "Configured ubuntu-image for the following model assertion:" + cat "$PREFIX".model-assertion + echo "----------------------------------------------------------" + # Fake finished configuration for lb build + mkdir -p .build + touch .build/config + exit 0 + ;; + none) OPTS="${OPTS:+$OPTS }--chroot-filesystem $IMAGEFORMAT" ;; From b8b2e343827adb9020d5b71f232c0361bd72685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 4 Oct 2018 19:38:40 +0200 Subject: [PATCH 2/6] Missing dep --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 015b5987..00739806 100644 --- a/debian/control +++ b/debian/control @@ -32,6 +32,7 @@ Depends: ${misc:Depends}, rsync, snapd, squashfs-tools (>= 1:3.3-1), + ubuntu-image, vmdk-stream-converter [amd64 i386], xz-utils, zerofree From 3291e971de68ec251b1a1172d855bc9c76c07ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 10 Oct 2018 21:59:36 +0200 Subject: [PATCH 3/6] The model assertions for 18 don't actually use series=18 because that would be too logical. --- live-build/auto/config | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 9cb6a833..f2942da4 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -172,15 +172,17 @@ case $IMAGEFORMAT in esac case $SUITE in xenial) - CORE_SERIES=16 ;; + # Ubuntu Core 16 + ;; *) - CORE_SERIES=18 ;; + # Ubuntu Core 18 + MODEL="ubuntu-core-18-$MODEL" ;; esac echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> 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=$CORE_SERIES model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion + env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 model="$MODEL" brand-id=canonical > "$PREFIX".model-assertion echo "Configured ubuntu-image for the following model assertion:" cat "$PREFIX".model-assertion echo "----------------------------------------------------------" From 872d4f6e7fefe00d48e959bb034ec5f130f3ecef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Thu, 11 Oct 2018 17:13:35 +0200 Subject: [PATCH 4/6] For the pc model, the name changed so we need to special case it a bit. --- live-build/auto/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/auto/config b/live-build/auto/config index f2942da4..9eef13e9 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -176,7 +176,7 @@ case $IMAGEFORMAT in ;; *) # Ubuntu Core 18 - MODEL="ubuntu-core-18-$MODEL" ;; + MODEL="ubuntu-core-18-${MODEL#pc-}" ;; esac echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common From 8e8fb0bf09debdd61de0a3a542bba0edae15b3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 24 Oct 2018 17:55:00 +0200 Subject: [PATCH 5/6] Add bug to changelog. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 134c6eb7..c600af97 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,7 @@ livecd-rootfs (2.408.39) UNRELEASED; urgency=medium IMAGEFORMAT=ubuntu-image). * Decide what model assertion series to fetch depending on the suite. Use 16 for xenial and 18 for other series (bionic+). This enables core18 image - builds. + builds (LP: #1799736). -- Łukasz 'sil2100' Zemczak Thu, 04 Oct 2018 19:30:17 +0200 From f64e3c998154038726d447d9a8530a13c6e430dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Mon, 29 Oct 2018 17:57:43 +0100 Subject: [PATCH 6/6] As Steve pointed out, the auto/build PREFIX change was a move, not an addition. --- live-build/auto/build | 3 --- 1 file changed, 3 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 57dd674e..24a68ad5 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -372,9 +372,6 @@ else exit 1 fi -# Link output files somewhere BuildLiveCD will be able to find them. -PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" - case $LB_INITRAMFS in casper) INITFS="casper"