diff --git a/debian/changelog b/debian/changelog index 16b8d012..c600af97 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +livecd-rootfs (2.408.39) 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 (LP: #1799736). + + -- Ɓukasz 'sil2100' Zemczak Thu, 04 Oct 2018 19:30:17 +0200 + livecd-rootfs (2.408.38) xenial; urgency=medium * ubuntu-cpc: Handle a pre-existing /lib/modules in 030-root-tarball.hook diff --git a/debian/control b/debian/control index ab1cc33f..00739806 100644 --- a/debian/control +++ b/debian/control @@ -30,7 +30,9 @@ Depends: ${misc:Depends}, python3-software-properties, qemu-utils, rsync, + snapd, squashfs-tools (>= 1:3.3-1), + ubuntu-image, vmdk-stream-converter [amd64 i386], xz-utils, zerofree diff --git a/live-build/auto/build b/live-build/auto/build index 69d8d94d..24a68ad5 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 @@ -350,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" diff --git a/live-build/auto/config b/live-build/auto/config index 2e7c2e25..9eef13e9 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,53 @@ 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) + # Ubuntu Core 16 + ;; + *) + # Ubuntu Core 18 + MODEL="ubuntu-core-18-${MODEL#pc-}" ;; + 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=16 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" ;;