diff --git a/stage2/04-cloud-init/00-packages b/stage2/04-cloud-init/00-packages index db064e6..4892d37 100644 --- a/stage2/04-cloud-init/00-packages +++ b/stage2/04-cloud-init/00-packages @@ -1 +1,2 @@ cloud-init +rpi-cloud-init-mods diff --git a/stage2/04-cloud-init/01-run.sh b/stage2/04-cloud-init/01-run.sh index 5ccebdf..9a4622e 100755 --- a/stage2/04-cloud-init/01-run.sh +++ b/stage2/04-cloud-init/01-run.sh @@ -5,24 +5,8 @@ if [ "${ENABLE_CLOUD_INIT}" != "1" ]; then exit 0 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 yet +# some preseeding without any runtime effect if not modified # 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/user-data "${ROOTFS_DIR}/boot/firmware/user-data" -#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 +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/network-config "${ROOTFS_DIR}/boot/firmware/network-config" diff --git a/stage2/04-cloud-init/README.txt b/stage2/04-cloud-init/README.txt index cbe448d..00da52e 100644 --- a/stage2/04-cloud-init/README.txt +++ b/stage2/04-cloud-init/README.txt @@ -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 @@ -8,7 +8,3 @@ Reference for Raspberry Pi custom cloud-init config module: https://cloudinit.re - 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. diff --git a/stage2/04-cloud-init/files/00-network-manager-all.yaml b/stage2/04-cloud-init/files/00-network-manager-all.yaml deleted file mode 100644 index b654768..0000000 --- a/stage2/04-cloud-init/files/00-network-manager-all.yaml +++ /dev/null @@ -1,3 +0,0 @@ -network: - version: 2 - renderer: NetworkManager diff --git a/stage2/04-cloud-init/files/99_raspberry-pi.cfg b/stage2/04-cloud-init/files/99_raspberry-pi.cfg deleted file mode 100644 index 7134d90..0000000 --- a/stage2/04-cloud-init/files/99_raspberry-pi.cfg +++ /dev/null @@ -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: []