Add script to set hostname and SSID after preparing an SD card.

Example usage, after dd-ing to /dev/sdb:

    ./number /dev/sdb 42

WARNING: Make sure you get the right device: no checks, no prompts!
This commit is contained in:
Cyril Brulebois 2024-08-12 18:36:56 +02:00
parent c748d2d399
commit 919128f51a

23
number Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# Tweak hostname and SSID
set -e
DEV="$1"
N="$2"
if [ -z "$DEV" ] || [ -z "$N" ]; then
echo "E: $0 /dev/sd-card number"
exit 1
fi
MNT=/mnt
sudo mount ${DEV}2 $MNT
sudo sed "s/pirogue/pirogue-$N/" -i $MNT/etc/hostname
sudo sed "s/pirogue/pirogue-$N/g" -i $MNT/etc/hosts
sudo mkdir -p $MNT/var/lib/pirogue/config/
echo "WIFI_NETWORK_NAME=PiRogue$N" | sudo tee -a $MNT/var/lib/pirogue/config/pirogue.user.env
sudo umount $MNT