From de6bd722ae1c82766d1b037be8814b55f3249a73 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 28 Apr 2017 15:15:12 -0700 Subject: [PATCH] Import patches-unapplied version 2.442 to ubuntu/artful-proposed Imported using git-ubuntu import. Changelog parent: 41970327be7f22d59e7a862b01286caad1a95f6a New changelog entries: [ Robert Jennings ] * live-build/ubuntu-cpc/hooks/060-ipv6.chroot: remove faulty release comparison prior to aa-series (LP: #1681548) * live-build/ubuntu-cpc/hooks/999-extras.binary: Exit on first failure [ Balint Reczey ] * sync before calling kpartx to let writing to loop devices finish * Sort and list dependencies nicely * Require PROJECT environment to be set for lb build * Allow overwriting IMAGEFORMAT even for ubuntu-cpc and ubuntu-server * Optionally use ubuntu-image for building snap based images --- debian/changelog | 16 +++++++ debian/control | 20 +++++++- live-build/auto/build | 11 +++++ live-build/auto/config | 47 +++++++++++++++---- live-build/functions | 2 + live-build/ubuntu-cpc/hooks/060-ipv6.chroot | 9 +--- live-build/ubuntu-cpc/hooks/999-extras.binary | 2 +- 7 files changed, 89 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index c439a56a..e2f2b9d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +livecd-rootfs (2.442) artful; urgency=medium + + [ Robert Jennings ] + * live-build/ubuntu-cpc/hooks/060-ipv6.chroot: remove faulty release + comparison prior to aa-series (LP: #1681548) + * live-build/ubuntu-cpc/hooks/999-extras.binary: Exit on first failure + + [ Balint Reczey ] + * sync before calling kpartx to let writing to loop devices finish + * Sort and list dependencies nicely + * Require PROJECT environment to be set for lb build + * Allow overwriting IMAGEFORMAT even for ubuntu-cpc and ubuntu-server + * Optionally use ubuntu-image for building snap based images + + -- Steve Langasek Fri, 28 Apr 2017 15:15:12 -0700 + livecd-rootfs (2.441.2) zesty; urgency=medium * The ubuntu-server:live should use a casper-based initramfs to work diff --git a/debian/control b/debian/control index 52e4d3b2..9ecc7dbe 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,25 @@ Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/livecd-rootfs/trunk Package: livecd-rootfs Architecture: any -Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, lsb-release, lzma, e2fsprogs, germinate (>= 1.25.1), apt-utils, gnupg, live-build (>= 3.0~a57-1ubuntu12~), android-tools-fsutils [armhf], python3-software-properties +Depends: ${misc:Depends}, + android-tools-fsutils [armhf], + apt-utils, + debootstrap, + e2fsprogs, + germinate (>= 1.25.1), + gnupg, + grep-dctrl, + live-build (>= 3.0~a57-1ubuntu12~), + lsb-release, + lzma, + procps, + python-minimal | python, + python3-software-properties, + rsync, + 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 103b5005..cfe00bdd 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -10,6 +10,17 @@ 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 + +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 2d2ade92..34937680 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -104,14 +104,16 @@ add_binary_hook () BINARY_HOOKS="${BINARY_HOOKS:+$BINARY_HOOKS }$1" } -case $PROJECT:$SUBPROJECT in - ubuntu-cpc:*) - IMAGEFORMAT=ext4 - ;; - ubuntu-server:live) - IMAGEFORMAT=plain - ;; -esac +if [ -z "${IMAGEFORMAT:-}" ]; then + case $PROJECT:$SUBPROJECT in + ubuntu-cpc:*) + IMAGEFORMAT=ext4 + ;; + ubuntu-server:live) + IMAGEFORMAT=plain + ;; + esac +fi case $IMAGEFORMAT in ext2|ext3|ext4) @@ -148,6 +150,35 @@ case $IMAGEFORMAT in OPTS="${OPTS:+$OPTS }--initramfs $INITRAMFS_TYPE --chroot-filesystem $IMAGEFORMAT" ;; + 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) diff --git a/live-build/functions b/live-build/functions index 5abdeea1..313a559b 100644 --- a/live-build/functions +++ b/live-build/functions @@ -13,6 +13,8 @@ apt-get -qqy install dosfstools gdisk clean_loops() { if [ -n "${backing_img}" ]; then + # sync before removing loop to avoid "Device or resource busy" errors + sync kpartx -v -d "${backing_img}" unset backing_img fi diff --git a/live-build/ubuntu-cpc/hooks/060-ipv6.chroot b/live-build/ubuntu-cpc/hooks/060-ipv6.chroot index 3d4a0be2..532b8473 100755 --- a/live-build/ubuntu-cpc/hooks/060-ipv6.chroot +++ b/live-build/ubuntu-cpc/hooks/060-ipv6.chroot @@ -1,15 +1,8 @@ #!/bin/bash # -# Disable IPv6 privacy extensions on Utopic and later +# Disable IPv6 privacy extensions # -codename=$(sh -c 'lsb_release --short --codename') -dist_ge() { [[ "$1" > "$2" || "$1" == "$2" ]]; } - -if ! dist_ge "${codename}" "trusty"; then - exit 0 -fi - cat << EOF > /etc/sysctl.d/99-cloudimg-ipv6.conf # Written by the Cloud Image build process # See https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1068756 diff --git a/live-build/ubuntu-cpc/hooks/999-extras.binary b/live-build/ubuntu-cpc/hooks/999-extras.binary index 39c464de..0d506ea4 100755 --- a/live-build/ubuntu-cpc/hooks/999-extras.binary +++ b/live-build/ubuntu-cpc/hooks/999-extras.binary @@ -13,4 +13,4 @@ export CLOUD_IMG_STR="$IMAGE_STR" export FS_LABEL="cloudimg-rootfs" # Cleaner execution -/bin/run-parts --regex ".*\.binary" "${extra_d}" +/bin/run-parts --exit-on-error --regex ".*\.binary" "${extra_d}"