diff --git a/debian/changelog b/debian/changelog index f99d569d..048194a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,11 @@ livecd-rootfs (2.525.32) UNRELEASED; urgency=medium * Fix a terrible typo in auto/build that causes all core18 builds to fail on this series (LP: #1849343). + * Backport 999-ubuntu-image-customization.chroot to have a common place for + our cloud-init datasource. Add some modifications on top to make sure the + legacy raspi2 configuration stays the same. (LP: #1849472) - -- Łukasz 'sil2100' Zemczak Tue, 22 Oct 2019 17:09:57 +0200 + -- Łukasz 'sil2100' Zemczak Tue, 22 Oct 2019 17:34:31 +0200 livecd-rootfs (2.525.31) bionic; urgency=medium diff --git a/live-build/auto/config b/live-build/auto/config index 0bd786f8..8d800e4e 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -930,6 +930,8 @@ 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 "IMAGEFORMAT=\"$IMAGEFORMAT\"" >> config/chroot +echo "SUBARCH=\"$SUBARCH\"" >> config/chroot case $ARCH+$SUBARCH in armhf+raspi2|armhf+raspi3|arm64+raspi3) diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot index 16e1be5a..ed68736d 100755 --- a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot @@ -142,22 +142,17 @@ fi #### END COMMON ARCH FUNCTIONS -case $arch in - # ARM images are special - armhf|arm64) - # Dirty hack because SUBARCH doesn't exist when running chroot hooks, - # and we don't want raspi2 images to depend on a cloud data source: - if _xchroot "${rootd}" dpkg -l linux-image-raspi2 2>/dev/null | grep -q '^.i'; then - fake_cloud_init - fi - - echo "Image architecture is ARM. Existing vmbuilder-fixups" - - exit 0 - ;; - powerpc|ppc64el|s390x) - exit 0 - ;; +case $arch+${SUBARCH:-} in + # raspi2 images are special + armhf+raspi2) + fake_cloud_init + echo "Image architecture is ARM. Existing vmbuilder-fixups" + exit 0 + ;; + + armhf+*|arm64+*|powerpc+*|ppc64el+*|s390x+*) + exit 0 + ;; esac psuedo_grub_probe() { diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot new file mode 100755 index 00000000..491bd863 --- /dev/null +++ b/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot @@ -0,0 +1,23 @@ +#!/bin/bash -ex + +. /root/config/chroot + +# Specific ubuntu-image chroot configuration goes here. +# Currently the none IMAGEFORMAT is equivalent to building a rootfs for an image +# for a physical device, not a cloud instance. For such images we want some +# special cloud-init configuration that should not be happening for cloud +# cases. This check should be changed to a per-MODEL/per-SUBARCH check once +# we support building cloud images via ubuntu-image. +if [ "$IMAGEFORMAT" == "none" ]; then + # If the cloud does not provide a meta-data service this should be run + # This will setup a nocloud datasource on the boot partition. + # This is the default behavior for our ubuntu-image built preinstalled + # images. + cat << EOF > /etc/cloud/cloud.cfg.d/99-fake_cloud.cfg +# configure cloud-init for NoCloud +datasource_list: [ NoCloud, None ] +datasource: + NoCloud: + fs_label: system-boot +EOF +fi