funktion stop meldung hinzugefügt + fehler korrek.
This commit is contained in:
parent
536a8421af
commit
1b96bb46e3
11
wg_stop
11
wg_stop
@ -6,15 +6,6 @@
|
|||||||
a_user=$(whoami)
|
a_user=$(whoami)
|
||||||
wg_wdir="/home/$a_user/.config/wg_nmcli/"
|
wg_wdir="/home/$a_user/.config/wg_nmcli/"
|
||||||
wg_pic="/home/$a_user/.icons/"
|
wg_pic="/home/$a_user/.icons/"
|
||||||
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
|
||||||
if [ -z $active ]
|
|
||||||
then
|
|
||||||
yad --image-on-top --image=${wg_pic}wg-info.png \
|
|
||||||
--text="There is no active tunnel that you could stop.\n" \
|
|
||||||
--text-align=center --button="OK" --title "Wire-G" \
|
|
||||||
--fixed --center --buttons-layout=center --borders=8 --center
|
|
||||||
exit 0
|
|
||||||
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) )
|
||||||
#echo ${lines[0]} #Damit wird der Inhalt ausgelesen. (Index angeben)
|
#echo ${lines[0]} #Damit wird der Inhalt ausgelesen. (Index angeben)
|
||||||
@ -27,7 +18,7 @@
|
|||||||
disable=$(grep -i "deaktiviert" ${wg_wdir}.stop.txt)
|
disable=$(grep -i "deaktiviert" ${wg_wdir}.stop.txt)
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then
|
then
|
||||||
notify-send --icon=${wg_pic}wg-stop.png "$wert Verbindung wurde getrennt."
|
notify-send --icon=${wg_pic}wg-stop.png "$wert Connection disconnected."
|
||||||
pkill yad
|
pkill yad
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
22
wire_g
22
wire_g
@ -67,7 +67,7 @@ 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
|
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
|
||||||
@ -125,6 +125,24 @@ export -f remove
|
|||||||
# function end
|
# function end
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
|
#funktion for active tunnel a stop
|
||||||
|
up_or_down(){
|
||||||
|
|
||||||
|
if [ -z $active ]
|
||||||
|
then
|
||||||
|
yad --image-on-top --image=${wg_pic}wg-info.png \
|
||||||
|
--text="There is no active tunnel that you could stop.\n" \
|
||||||
|
--text-align=center --button="OK" --title "Wire-G" \
|
||||||
|
--fixed --center --buttons-layout=center --borders=8 --center
|
||||||
|
else
|
||||||
|
wg_stop
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# funktion end
|
||||||
|
############################################################################################################
|
||||||
|
############################################################################################################
|
||||||
# function button "more"
|
# function button "more"
|
||||||
|
|
||||||
more(){
|
more(){
|
||||||
@ -141,7 +159,7 @@ more(){
|
|||||||
--fixed --borders=8 --close-on-unfocus \
|
--fixed --borders=8 --close-on-unfocus \
|
||||||
--buttons-layout=center \
|
--buttons-layout=center \
|
||||||
--button=Import:"bash -c import_wg" \
|
--button=Import:"bash -c import_wg" \
|
||||||
--button="Wire-G Stop":"bash -c wg_stop" \
|
--button="Wire-G Stop":up_or_down \
|
||||||
--button="Cancel":1 \
|
--button="Cancel":1 \
|
||||||
--separator="" --window-icon=${wg_pic}wg-vpn.png)
|
--separator="" --window-icon=${wg_pic}wg-vpn.png)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user