test mit export für entfernen

This commit is contained in:
Désiré Werner Menrath 2023-11-10 20:48:17 +01:00
parent 4452bc73a0
commit 363894584d

33
wire_g
View File

@ -113,10 +113,8 @@ import_wg(){
<b>No valid Wireguard file.</b> \n <b>No valid Wireguard file.</b> \n
<b>Here is an example:</b><span color='#0fad0a'><b> my_wireguard.conf</b></span> \n" <b>Here is an example:</b><span color='#0fad0a'><b> my_wireguard.conf</b></span> \n"
import_wg ;; import_wg ;;
esac esac
fi fi }
}
export -f import_wg export -f import_wg
# function end # function end
@ -132,19 +130,6 @@ remove(){
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${wg_wdir}.wg_noactive.txt nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${wg_wdir}.wg_noactive.txt
active=$(cat ${wg_wdir}.wg_noactive.txt) active=$(cat ${wg_wdir}.wg_noactive.txt)
if selection=$(yad --no-click --list --center \
--window-icon=${wg_pic}wg-trash.png \
--height=300 --width=60 --title="Wire-G Trash" \
--buttons-layout=center --separator="" \
--button=$"OK" --button=$"Cancel" \
--borders=8 --image-on-top --image=${wg_pic}wg-active.png \
--column=$"Delete" $tunnel \
--text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$active</b></span>
<b>----------------------------------------------------------------------------------</b>
<b>If no tunnels are listed,</b>
<b>so they have to import their tunnel beforehand.</b>")
then
nmcli connection delete $selection &> ${wg_wdir}.tmp.txt nmcli connection delete $selection &> ${wg_wdir}.tmp.txt
if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt) if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
then then
@ -164,8 +149,7 @@ remove(){
then then
pkill wire_g pkill wire_g
pkill yad pkill yad
fi fi }
fi }
export -f remove export -f remove
# function end # function end
@ -231,12 +215,12 @@ connect(){
############################################################################################################ # --text "<b>Aktiver Tunnel:</b> <span color='#0fad0a'><b>$active</b></span> # mit <b>gewünschtes wort</b> wird fett geschrieben. ############################################################################################################ # --text "<b>Aktiver Tunnel:</b> <span color='#0fad0a'><b>$active</b></span> # mit <b>gewünschtes wort</b> wird fett geschrieben.
# Farbe für Variable $active festgelegt mit fetter Schrift. (bei --text zwischen " ") # Farbe für Variable $active festgelegt mit fetter Schrift. (bei --text zwischen " ")
if selection=$(yad --no-click --list \ if selection=$(yad --list --center \
--center \
--height=300 --width=60 --title="Wire-G" \ --height=300 --width=60 --title="Wire-G" \
--buttons-layout=center \ --buttons-layout=center \
--button=$"Start:0" --button=$"Stop":"bash -c up_or_down" \ --button=$"OK" --button=$"Stop":"bash -c up_or_down" \
--button=$"Import":"bash -c import_wg" --button=$"Remove":"bash -c remove" --separator="" \ --button=$"Import":"bash -c import_wg" \
--button=$"Remove":"bash -c remove" --separator="" \
--button=$"About":"bash -c about" \ --button=$"About":"bash -c about" \
--window-icon=${wg_pic}wg-vpn.png \ --window-icon=${wg_pic}wg-vpn.png \
--borders=8 --image-on-top --image=${wg_pic}wg-active.png \ --borders=8 --image-on-top --image=${wg_pic}wg-active.png \
@ -245,9 +229,8 @@ if selection=$(yad --no-click --list \
<b>----------------------------------------------------------------------------------</b> <b>----------------------------------------------------------------------------------</b>
<b>If no tunnels are listed,</b> <b>If no tunnels are listed,</b>
<b>so they have to import their tunnel beforehand.</b>") <b>so they have to import their tunnel beforehand.</b>")
export selection
then then
if [[ -n $active ]] if [[ -n $active ]]
then then
wg_stop wg_stop