dotfiles/bin/iwqr

15 lines
377 B
Text
Raw Permalink Normal View History

#!/bin/sh -e
if [ "$(whoami)" != root ]; then
exec sudo "$0" "$@"
fi
cd /var/lib/iwd
field='Connected network'
2023-12-10 12:20:55 +01:00
ssid=$(iwctl station wlan0 show | grep '^\s*'"${field}"'\s' | xargs | sed "s/^${field} //")
unset field
2023-12-10 12:20:55 +01:00
passphrase=$(awk -F = '($1 == "Passphrase") { print $2 }' "${ssid}.psk")
qrencode -s 1 -l H -o - "WIFI:T:WPA;S:${ssid};P:${passphrase};;" | catimg -H 0 -