Add firstboot provisioning

This commit is contained in:
2025-04-21 22:14:35 +02:00
parent b9cdb9fa15
commit e7a3587501
6 changed files with 74 additions and 4 deletions

7
rootfs/lib/firstboot.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Generate a unique hostname
NEW_HOSTNAME="rpi-$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2 | tail -c 5)"
echo "$NEW_HOSTNAME" > /etc/hostname
sed -i "s/raspberrypi/$NEW_HOSTNAME/g" /etc/hosts
hostname "$NEW_HOSTNAME"