From 810b9743f6f0faea082ddc7ecb544e05b5870986 Mon Sep 17 00:00:00 2001 From: oxmc7769 Date: Thu, 5 Mar 2026 03:13:45 -0800 Subject: [PATCH] Almost --- stage2/04-cloud-init/01-run-amd64.sh | 13 +++++++++++++ .../{01-run.sh => 01-run-arm-only.sh} | 0 stage2/04-cloud-init/README.amd64.txt | 15 +++++++++++++++ stage2/04-cloud-init/README.rpi.txt | 15 +++++++++++++++ stage2/04-cloud-init/README.txt | 9 --------- stage2/04-cloud-init/files/meta-data-amd64 | 18 ++++++++++++++++++ 6 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 stage2/04-cloud-init/01-run-amd64.sh rename stage2/04-cloud-init/{01-run.sh => 01-run-arm-only.sh} (100%) create mode 100644 stage2/04-cloud-init/README.amd64.txt create mode 100644 stage2/04-cloud-init/README.rpi.txt delete mode 100644 stage2/04-cloud-init/README.txt create mode 100644 stage2/04-cloud-init/files/meta-data-amd64 diff --git a/stage2/04-cloud-init/01-run-amd64.sh b/stage2/04-cloud-init/01-run-amd64.sh new file mode 100644 index 0000000..5357d04 --- /dev/null +++ b/stage2/04-cloud-init/01-run-amd64.sh @@ -0,0 +1,13 @@ +#!/bin/bash -e + +if [ "${ENABLE_CLOUD_INIT}" != "1" ]; then + log "Skipping cloud-init stage" + exit 0 +fi + +SEED_DIR="${ROOTFS_DIR}/var/lib/cloud/seed/nocloud" +mkdir -p "${SEED_DIR}" + +install -v -m 644 files/meta-data-amd64 "${SEED_DIR}/meta-data" +install -v -m 644 files/user-data "${SEED_DIR}/user-data" +install -v -m 644 files/network-config "${SEED_DIR}/network-config" diff --git a/stage2/04-cloud-init/01-run.sh b/stage2/04-cloud-init/01-run-arm-only.sh similarity index 100% rename from stage2/04-cloud-init/01-run.sh rename to stage2/04-cloud-init/01-run-arm-only.sh diff --git a/stage2/04-cloud-init/README.amd64.txt b/stage2/04-cloud-init/README.amd64.txt new file mode 100644 index 0000000..0450e04 --- /dev/null +++ b/stage2/04-cloud-init/README.amd64.txt @@ -0,0 +1,15 @@ +Cloud-Init support for amd64 (PC/Desktop) + +Reference: https://cloudinit.readthedocs.io/ + +Config files are installed to /var/lib/cloud/seed/nocloud/ which is the +standard NoCloud datasource seed directory for non-RPi systems. + +- files/network-config Network configuration template (netplan format) + +- files/user-data Example user-data configuration + +- files/meta-data-amd64 Cloud-init instance config (instance_id: chillcraftos-image) + +The NoCloud datasource is used so cloud-init picks up config from the local +seed directory on first boot without requiring a network metadata service. diff --git a/stage2/04-cloud-init/README.rpi.txt b/stage2/04-cloud-init/README.rpi.txt new file mode 100644 index 0000000..a67aeb4 --- /dev/null +++ b/stage2/04-cloud-init/README.rpi.txt @@ -0,0 +1,15 @@ +Cloud-Init support for Raspberry Pi (ARM) + +Reference for Raspberry Pi custom cloud-init config module: https://cloudinit.readthedocs.io/en/latest/reference/modules.html#raspberry-pi-configuration + +Config files are installed to /boot/firmware/ so they are accessible from the +boot partition before the root filesystem is fully mounted. + +- files/network-config Network configuration template (netplan format) + +- files/user-data Example user-data configuration + +- files/meta-data Cloud-init instance config (instance_id: rpios-image) + +The rpi-cloud-init-mods package (from 00-packages-arm-only) provides additional +Raspberry Pi specific cloud-init modules. diff --git a/stage2/04-cloud-init/README.txt b/stage2/04-cloud-init/README.txt deleted file mode 100644 index d12f955..0000000 --- a/stage2/04-cloud-init/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -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 - -- files/network-config is required because otherwise imager would fail to create the correct filesystem entry - -- files/user-data same reason and to include some example configurations - -- files/meta-data Cloud-init instance configuration \ No newline at end of file diff --git a/stage2/04-cloud-init/files/meta-data-amd64 b/stage2/04-cloud-init/files/meta-data-amd64 new file mode 100644 index 0000000..5febb4b --- /dev/null +++ b/stage2/04-cloud-init/files/meta-data-amd64 @@ -0,0 +1,18 @@ +# This is the meta-data configuration file for cloud-init. Please refer to the +# cloud-init documentation for more information: +# +# https://cloudinit.readthedocs.io/ + +# Set the datasource mode to "local". This ensures that user-data is acted upon +# prior to bringing up the network (because everything about the datasource is +# assumed to be local). If you wish to use an HTTP datasource instead, you can +# change this to "net" or override it on the kernel cmdline (see README). +dsmode: local + +# Specifies the "unique" identifier of the instance. Typically in cloud-init +# this is generated by the owning cloud and is actually unique (to some +# degree). Here our data-source is local, so this is just a fixed string. +# Warning: changing this will cause cloud-init to assume it is running on a +# "new" instance, and to go through first time setup again (the value is +# compared to a cached copy). +instance_id: chillcraftos-image \ No newline at end of file