Ajout : script qrconn

This commit is contained in:
Hippolyte Chauvin 2023-07-20 19:54:33 +02:00
parent cd4fb8d3d9
commit 4f818076b7

17
bin/qrconn Executable file
View file

@ -0,0 +1,17 @@
#!/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 -