#cloud-config
#
# What turns a stock Raspberry Pi OS card into a gled server. This is
# vendor-data, not user-data, on purpose: cloud-init merges the two, and
# whoever flashes the card edits user-data (and network-config) for the network
# and a login. Keeping the gled setup here means those edits, including the ones
# Raspberry Pi Imager writes, cannot switch it off by accident.
# The root filesystem stays at its image size: it ends up read-only under an
# overlay. What has to persist lives on the third partition (label gleddata),
# which the setup script mounts at /data.
growpart:
mode: off
resize_rootfs: false
# Raspberry Pi OS ships with the SSH server switched off. cloud-init's ssh module
# switches it on early in the first boot, before the setup below runs, so a
# setup that fails half way still leaves a Pi you can log in to and look at.
enable_ssh: true
runcmd:
# FAT carries no execute bit, so the script is handed to bash by path.
- [ bash, /boot/firmware/gled-setup.sh ]
# The setup ends by turning the root filesystem read-only, which takes effect on
# the next boot. The condition keeps the Pi up if the setup failed, so the log
# can be read over SSH or on the card.
power_state:
mode: reboot
condition: [ test, -f, /boot/firmware/gled-setup.OK ]
message: gled installed, rebooting into the read-only system