14 lines
377 B
Text
Executable file
14 lines
377 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 wlan0 show | grep '^\s*'"${field}"'\s' | xargs | sed "s/^${field} //")
|
|
unset field
|
|
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 -
|