1
0
Fork 0
forked from ahurac/dotfiles
ahuarc-dotfiles/bin/qrconn

18 lines
353 B
Text
Raw Normal View History

2023-07-20 19:54:33 +02:00
#!/bin/sh -e
if [ "$(whoami)" != root ]; then
exec sudo "$0" "$@"
fi
cd "/var/lib/connman/$(connmanctl services | head -n 1 | awk '{ print $NF }')"
get_var() {
awk -F = '($1 == "'"${1}"'") { print $2 }' settings
}
ssid="$(get_var Name)"
psk="$(get_var Passphrase)"
qrencode -s 1 -l H -o - "WIFI:T:WPA;S:${ssid};P:${psk};;" | catimg -H 0 -