Compare commits

...

3 Commits

Author SHA1 Message Date
0af5947234 autoconnect.no add to remove 2023-11-27 12:12:26 +01:00
07d5ab0145 autoconnect.no to import 2023-11-27 12:11:16 +01:00
a32cd0560a autoconnect geändert 2023-11-27 09:19:40 +01:00
2 changed files with 8 additions and 14 deletions

View File

@ -41,10 +41,6 @@ ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/
--timeout 1 \ --timeout 1 \
--text=$"<span color='#0fad0a'><b>$ACTIVE</b></span> <span><b>powered</b></span>" --text=$"<span color='#0fad0a'><b>$ACTIVE</b></span> <span><b>powered</b></span>"
# autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind
IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) )
nmcli con mod "$lines" connection.autoconnect no
yad --notification \ yad --notification \
--image="${WG_PIC}wg-vpn.png" \ --image="${WG_PIC}wg-vpn.png" \
--icon-size=32 --no-middle \ --icon-size=32 --no-middle \

6
wire_g
View File

@ -37,7 +37,7 @@ ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/
############################################################################################################ ############################################################################################################
wg_notify(){ wg_notify(){
sleep 2 sleep 1
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
case $LANG in case $LANG in
@ -51,9 +51,6 @@ wg_notify(){
--text-align=center --no-buttons --auto-close \ --text-align=center --no-buttons --auto-close \
--timeout 1 \ --timeout 1 \
--text=$"<span color='#0fad0a'><b>$ACTIVE</b></span> <span><b>powered</b></span>" --text=$"<span color='#0fad0a'><b>$ACTIVE</b></span> <span><b>powered</b></span>"
# autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind
IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) )
nmcli con mod "$lines" connection.autoconnect no
yad --notification \ yad --notification \
--image="${WG_PIC}wg-vpn.png" \ --image="${WG_PIC}wg-vpn.png" \
@ -108,6 +105,7 @@ import_wg(){
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
wg_notify wg_notify
fi fi
nmcli con mod "$WG_CONF" connection.autoconnect no
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt
fi ;; fi ;;