From 13d50e4fa16fe11a90a64fbd24b0c1ed38483fe6 Mon Sep 17 00:00:00 2001 From: Adam Conrad Date: Sun, 14 Feb 2016 03:12:37 -0700 Subject: [PATCH] Import patches-unapplied version 2.377 to ubuntu/xenial-proposed Imported using git-ubuntu import. Changelog parent: 0ae1111c558c96f1ddd7b15e79e3c179301a7ac5 New changelog entries: * live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot: Add fake_cloud_init function to create a nocloud data source for cloud images that aren't meant to be used on real clouds and use it by default on armhf+raspi2 --- debian/changelog | 8 +++++ .../ubuntu-cpc/hooks/999-cpc-fixes.chroot | 32 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8b9d5b74..e148f7cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +livecd-rootfs (2.377) xenial; urgency=medium + + * live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot: Add fake_cloud_init + function to create a nocloud data source for cloud images that aren't + meant to be used on real clouds and use it by default on armhf+raspi2 + + -- Adam Conrad Sun, 14 Feb 2016 03:12:37 -0700 + livecd-rootfs (2.376) xenial; urgency=medium [ Michael Terry ] diff --git a/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot index 63ed7d5b..96e54203 100755 --- a/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot @@ -50,6 +50,33 @@ EOF sed -i "s/CONDEV/${condev}/g" "$idir/${condev}.conf" } +fake_cloud_init() { + # If the cloud does not provide a meta-data service this should be run + # This will setup a nocloud datasource. + + seed_d="${rootd}/var/lib/cloud/seed/nocloud-net" + mkdir -p "${seed_d}" + + # fake instance-id + cat << EOF > "${seed_d}/meta-data" +instance_id: cloud-image +EOF + + # fake user-data to create the default user/password + cat << EOF > "${seed_d}/user-data" +#cloud-config +password: ubuntu +chpasswd: ubuntu +ssh_pwauth: True +EOF + + # tell cloud-init not to look for meta-data sources + cat << EOF > ${rootd}/etc/cloud/cloud.cfg.d/99-fake_cloud.cfg +# configure cloud-init for NoCloud +datasource_list: [ NoCloud, None ] +EOF +} + ## -------------- # remove 127.0.1.1 entry (LP: #440757) _xchroot "${rootd}" sh -c 'sed -i "/^127.0.1.1/d" /etc/hosts' @@ -132,6 +159,11 @@ case $arch in armhf|arm64) echo "Configuring ARM Serial Port" add_serial_console ttyAMA0 + # 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"