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>
14 lines
536 B
Bash
Executable File
14 lines
536 B
Bash
Executable File
#!/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 "}"
|