Réécriture de qrencode et changement de nom pour IWD
This commit is contained in:
parent
a21ea002bc
commit
f17dd5aad2
2 changed files with 14 additions and 17 deletions
14
bin/iwqr
Executable file
14
bin/iwqr
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/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 -
|
17
bin/qrconn
17
bin/qrconn
|
@ -1,17 +0,0 @@
|
||||||
#!/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 -
|
|
||||||
|
|
Loading…
Reference in a new issue