From 4f818076b733c5b0991cf706d18470224f6aa5ab Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Thu, 20 Jul 2023 19:54:33 +0200 Subject: [PATCH] Ajout : script qrconn --- bin/qrconn | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 bin/qrconn diff --git a/bin/qrconn b/bin/qrconn new file mode 100755 index 0000000..8a05c89 --- /dev/null +++ b/bin/qrconn @@ -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 - +