mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-04-28 19:41:28 +00:00
Add a new u-i specific chroot hook, move the NoCloud system-boot cloud-init datasource configuration there to make sure all u-i built ship with it.
This commit is contained in:
parent
9584b2bf93
commit
f6cbbf01e1
@ -394,6 +394,9 @@ case $IMAGEFORMAT in
|
|||||||
|
|
||||||
echo "Configured ubuntu-image for the following gadget model: $MODEL"
|
echo "Configured ubuntu-image for the following gadget model: $MODEL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Save the model name used for building, mostly for any model-specific hook execution
|
||||||
|
echo "MODEL=$MODEL" >> config/common
|
||||||
# Fake finished configuration for lb build
|
# Fake finished configuration for lb build
|
||||||
mkdir -p .build
|
mkdir -p .build
|
||||||
touch .build/config
|
touch .build/config
|
||||||
|
@ -22,18 +22,6 @@ _xchroot() {
|
|||||||
#### COMMON architecture independent functions
|
#### COMMON architecture independent functions
|
||||||
arch=$(_xchroot "${rootd}" dpkg --print-architecture)
|
arch=$(_xchroot "${rootd}" dpkg --print-architecture)
|
||||||
|
|
||||||
fake_cloud_init() {
|
|
||||||
# If the cloud does not provide a meta-data service this should be run
|
|
||||||
# This will setup a nocloud datasource on the boot partition.
|
|
||||||
cat << EOF > ${rootd}/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
|
|
||||||
}
|
|
||||||
|
|
||||||
## --------------
|
## --------------
|
||||||
# remove 127.0.1.1 entry (LP: #440757)
|
# remove 127.0.1.1 entry (LP: #440757)
|
||||||
_xchroot "${rootd}" sh -c 'sed -i "/^127.0.1.1/d" /etc/hosts'
|
_xchroot "${rootd}" sh -c 'sed -i "/^127.0.1.1/d" /etc/hosts'
|
||||||
@ -128,19 +116,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
case $arch in
|
case $arch in
|
||||||
# ARM images are special
|
# ARM, ppc and s390 images are special
|
||||||
armhf|arm64)
|
armhf|arm64|powerpc|ppc64el|s390x)
|
||||||
# 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
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
18
live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot
Executable file
18
live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customization.chroot
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
. /root/config/common
|
||||||
|
|
||||||
|
# Specific ubuntu-image chroot configuration goes here.
|
||||||
|
if [ "$IMAGEFORMAT" == "ubuntu-image" ]; do
|
||||||
|
# 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
|
Loading…
x
Reference in New Issue
Block a user