#!/usr/bin/env bash # Copy this along with .not_logged_in_yet to armbian root dir, then run after successful login # Refresh: extract MAC address of wlan0 MAC=$(netplan status -f json | jq -r '.wlan0.macaddress') # Check that we actually got a MAC address if [[ -z "$MAC" ]]; then echo "Error: Could not retrieve MAC address from netplan." >&2 exit 1 fi echo "Detected MAC address: $MAC" # Assign cheese hostname based on MAC address case "$MAC" in 38:9c:80:46:26:c8) # ← Replace with your first real MAC HOSTNAME="brie" ;; 68:f8:ea:22:e1:3d) # ← Replace with your second real MAC HOSTNAME="gouda" ;; 99:88:77:66:55:44) # ← Replace with your third real MAC HOSTNAME="camembert" ;; *) echo "Unknown MAC address: $MAC ... hostname not changed." >&2 exit 1 ;; esac echo "Setting hostname to: $HOSTNAME" sudo hostnamectl set-hostname "$HOSTNAME" # Optional: also update /etc/hostname (hostnamectl usually does this, but to be safe) echo "$HOSTNAME" | sudo tee /etc/hostname >/dev/null echo "Hostname changed. Reboot or start a new shell to see the change."