remove 6 test

This commit is contained in:
Désiré Werner Menrath 2023-11-14 12:44:31 +01:00
parent 0f339b48f5
commit 67c63633b2

17
wire_g
View File

@ -115,22 +115,10 @@ export -f import_wg
# funktion wireguard remove
remove(){
a_user=$(whoami)
wg_pic="/home/$a_user/.icons/"
wg_wdir="/home/$a_user/.config/wg_nmcli/"
tunnel=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${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=200 --width=60 --undecorated \
--buttons-layout=center --separator="" \
--button=$"OK" --button=$"Cancel" \
--borders=8 \
--column=$"Delete" $tunnel)
then
nmcli connection delete $selection &> ${wg_wdir}.tmp.txt
if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
then
@ -151,8 +139,7 @@ remove(){
if [ "$selection" = "$active" ]
then
pkill yad
fi
fi }
fi }
# function end