Runtime Wi-Fi configuration with fallback

wifi-set changes the network without reflashing (hex-encoded SSID),
wifi-connect tries new -> previous -> build default, and a switch that
fails reverts automatically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 22:01:43 +01:00
co-authored by Claude Opus 5.5
parent 89bd21d1f2
commit 28d4a36b6b
3 changed files with 86 additions and 0 deletions

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# wifi-mkconf SSID [PSK] -> wpa_supplicant.conf on stdout. SSID is hex-encoded so
# any character (quotes, spaces, unicode) is safe; PSK quoted (wpa_supplicant takes the last ").
hex=$(printf '%s' "$1" | hexdump -v -e '/1 "%02x"')
[ -n "$hex" ] || exit 1
echo "ctrl_interface=/var/run/wpa_supplicant"
echo "update_config=0"
echo "network={"
echo " #ssid=\"$(printf '%s' "$1" | tr -d '\n')\""
echo " ssid=$hex"
echo " scan_ssid=1"
if [ -n "$2" ]; then echo " psk=\"$2\""; else echo " key_mgmt=NONE"; fi
echo "}"