diff --git a/README.md b/README.md index e69de29..3282cc3 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +`apt install alltray` diff --git a/watch_wg.sh b/watch_wg.sh new file mode 100755 index 0000000..8213c8e --- /dev/null +++ b/watch_wg.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +watch --color WG_COLOR_MODE=always wg diff --git a/wg.png b/wg.png new file mode 100644 index 0000000..b56a78e Binary files /dev/null and b/wg.png differ diff --git a/wifi-wg.service b/wifi-wg.service new file mode 100644 index 0000000..2262d96 --- /dev/null +++ b/wifi-wg.service @@ -0,0 +1,12 @@ +[Unit] +Description=Auto WiFi Wireguard connect +After=network.target +StartLimitIntervalSec=0 + +[Service] +Environment="DISPLAY=:0" +Restart=always +ExecStart=sudo wpa_cli -i wlo1 -a /home/william/wpa.sh + +[Install] +WantedBy=graphical.target diff --git a/wpa.sh b/wpa.sh new file mode 100755 index 0000000..2f8bc11 --- /dev/null +++ b/wpa.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# redirect all output into a logfile +# exec 1>> /tmp/test.log 2>&1 + +case "$2" in +CONNECTED) + # do stuff on connect with wlan0 + sleep 2; + + if grep -Fxq `iwgetid --ap --raw` /etc/theta_wg/ignore.txt + then + echo "none" + else + # code if not found + wg-quick up wg0-ron + fi + + ;; +DISCONNECTED) + # do stuff on disconnect with wlan0 + wg-quick down wg0-ron + ;; +*) + >&2 echo empty or undefined event for wlan0: "$2" + exit 1 + ;; +esac \ No newline at end of file