fehler korrigiert und stop skript übersetzt

This commit is contained in:
Désiré Werner Menrath 2023-11-01 09:05:51 +01:00
parent d81eec1ece
commit 536a8421af
2 changed files with 7 additions and 6 deletions

View File

@ -10,9 +10,10 @@
if [ -z $active ] if [ -z $active ]
then then
yad --image-on-top --image=${wg_pic}wg-info.png \ yad --image-on-top --image=${wg_pic}wg-info.png \
--text="Es gibt keinen aktiven Tunnel den man stoppen könnte.\n" \ --text="There is no active tunnel that you could stop.\n" \
--text-align=center --button="OK" --title "Wire-G" \ --text-align=center --button="OK" --title "Wire-G" \
--fixed --center --buttons-layout=center --borders=8 --center --fixed --center --buttons-layout=center --borders=8 --center
exit 0
fi fi
#Damit wird der inhalt von /home/$a_user/.config/wg_nmcli/.tunnel.txt in ein Array gespeichert #Damit wird der inhalt von /home/$a_user/.config/wg_nmcli/.tunnel.txt in ein Array gespeichert
IFS=$'\n' lines=( $(cat ${wg_wdir}.tunnel.txt) ) IFS=$'\n' lines=( $(cat ${wg_wdir}.tunnel.txt) )

8
wire_g
View File

@ -43,7 +43,7 @@ wg_notify(){
#Icon des Menübuttons definieren #Icon des Menübuttons definieren
echo "icon:${wg_pic}wg-vpn.png" >&3 echo "icon:${wg_pic}wg-vpn.png" >&3
#Name des Menüs definieren #Name des Menüs definieren
echo "tooltip:$active aktiv" >&3 echo "tooltip:$active activ" >&3
} }
export -f wg_notify export -f wg_notify
@ -67,10 +67,10 @@ import_wg(){
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
if [ -n $active ] if [ -n $active ]
then then
wg_stop
nmcli connection import type wireguard file $wgconf > ${wg_wdir}.tmp.txt nmcli connection import type wireguard file $wgconf > ${wg_wdir}.tmp.txt
wg_notify wg_notify
else else
wg_stop
nmcli connection import type wireguard file $wgconf > ${wg_wdir}.tmp.txt nmcli connection import type wireguard file $wgconf > ${wg_wdir}.tmp.txt
wg_notify wg_notify
fi fi
@ -181,13 +181,13 @@ selection=$(yad --no-click --list \
--column 'Selection' $tunnel) --column 'Selection' $tunnel)
if [ "$?" = "0" ] if [ "$?" = "0" ]
then then
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
if [ -n $active ] if [ -n $active ]
then then
wg_stop
nmcli connection up $selection &> ${wg_wdir}.tmp.txt nmcli connection up $selection &> ${wg_wdir}.tmp.txt
connect connect
else else
wg_stop
nmcli connection up $selection &> ${wg_wdir}.tmp.txt nmcli connection up $selection &> ${wg_wdir}.tmp.txt
connect connect
fi fi