stage2: Re-add cloud-init files to bootfs (#881)

Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
This commit is contained in:
Paul
2025-11-24 02:32:51 +01:00
committed by GitHub
parent a46065d9c0
commit cb05dfcc1c
5 changed files with 6 additions and 52 deletions

View File

@@ -1 +1,2 @@
cloud-init cloud-init
rpi-cloud-init-mods

View File

@@ -5,24 +5,8 @@ if [ "${ENABLE_CLOUD_INIT}" != "1" ]; then
exit 0 exit 0
fi fi
install -v -D -m 644 -t "${ROOTFS_DIR}/etc/cloud/cloud.cfg.d/" files/99_raspberry-pi.cfg # some preseeding without any runtime effect if not modified
# some preseeding without any runtime effect yet
# install meta-data file for NoCloud data-source to work # install meta-data file for NoCloud data-source to work
#install -v -m 755 files/meta-data "${ROOTFS_DIR}/boot/firmware/meta-data" install -v -m 755 files/meta-data "${ROOTFS_DIR}/boot/firmware/meta-data"
#install -v -m 755 files/user-data "${ROOTFS_DIR}/boot/firmware/user-data" install -v -m 755 files/user-data "${ROOTFS_DIR}/boot/firmware/user-data"
#install -v -m 755 files/network-config "${ROOTFS_DIR}/boot/firmware/network-config" install -v -m 755 files/network-config "${ROOTFS_DIR}/boot/firmware/network-config"
# setup default netplan config which will instruct netplan to pass control over to network-manager
# at boot time. This will make NetworkManager manage all devices and by default.
# Any Ethernet device will come up with DHCP, once carrier is detected
install -v -D -m 600 -t "${ROOTFS_DIR}/lib/netplan/" files/00-network-manager-all.yaml
if [ -n "${FIRST_USER_NAME}" ]; then
# set the default user name to the one provided via FIRST_USER_NAME
# this will make cloud-init create the user with that name instead of 'pi'
sed -i "s/name: pi/name: ${FIRST_USER_NAME}/" "${ROOTFS_DIR}/etc/cloud/cloud.cfg"
else
# remove the users:\n - default section from cloud.cfg
sed -i "/^users:/,/^- default/d" "${ROOTFS_DIR}/etc/cloud/cloud.cfg"
fi

View File

@@ -1,4 +1,4 @@
Cloud-init support for Raspberry Pi OS Cloud-Init support for Raspberry Pi OS
Reference for Raspberry Pi custom cloud-init config module: https://cloudinit.readthedocs.io/en/latest/reference/modules.html#raspberry-pi-configuration Reference for Raspberry Pi custom cloud-init config module: https://cloudinit.readthedocs.io/en/latest/reference/modules.html#raspberry-pi-configuration
@@ -8,7 +8,3 @@ Reference for Raspberry Pi custom cloud-init config module: https://cloudinit.re
- files/meta-data Cloud-init instance configuration - files/meta-data Cloud-init instance configuration
- files/99_raspberry-pi.cfg Cloud-init datasource configuration
- files/00-network-manager-all.yaml Example from netplan docs/ubuntu for handing over control from
netplan to NetworkManager by default.

View File

@@ -1,3 +0,0 @@
network:
version: 2
renderer: NetworkManager

View File

@@ -1,24 +0,0 @@
# configure cloud-init with NoCloud
datasource_list: [ NoCloud, None ]
datasource:
NoCloud:
seedfrom: file:///boot/firmware
# Leave SSH key emission to console disabled so that
# users can decide whether to enable it manually.
ssh:
emit_keys_to_console: false
no_ssh_fingerprints: true
# Disable SSH host key generation
# regenerate_ssh_host_keys.service will take care
# of it on first boot
ssh_deletekeys: false
# Disable generation as it could be that the new keys
# aren't available yet when the service runs.
# also they are really only needed for the ssh service
# which will only run after the keys are already present
# so we don't schedule cloud-init after key generation
# as that would delay first boot too much
ssh_genkeytypes: []