You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
livecd-rootfs/live-build/ubuntu-cpc/hooks.d/chroot/999-ubuntu-image-customizat...

38 lines
1.4 KiB

#!/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
mkdir -p /etc/systemd/system/cloud-init-local.service.d
cat << EOF > /etc/systemd/system/cloud-init-local.service.d/mount-seed.conf
# Ensure our customized seed location is mounted prior to execution
[Unit]
RequiresMountsFor=/boot/firmware
EOF
mkdir -p /etc/systemd/system/cloud-config.service.d
cat << EOF > /etc/systemd/system/cloud-config.service.d/getty-wait.conf
# Wait for cloud-init to finish (creating users, etc.) before running getty
[Unit]
Before=getty.target
EOF
fi