18 lines
353 B
Text
18 lines
353 B
Text
|
#!/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 -
|
||
|
|