1
0
Fork 0
forked from ahurac/dotfiles
ahuarc-dotfiles/bin/iwqr
2023-12-01 13:03:41 +01:00

14 lines
374 B
Text
Executable file

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