Bei import if -n $active hinzugefügt

funktionen lesbarkeit angepasst
This commit is contained in:
Désiré Werner Menrath 2023-10-30 19:44:47 +01:00
parent 5bebb7ccaf
commit 298f3998d3

7
wire_g
View File

@ -63,10 +63,17 @@ import_wg(){
--window-icon=${wg_pic}wg-import.png \ --window-icon=${wg_pic}wg-import.png \
--title="Wireguard .conf Datei auswählen") --title="Wireguard .conf Datei auswählen")
if [ "$?" = "0" ] if [ "$?" = "0" ]
then
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
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
nmcli connection import type wireguard file $wgconf > ${wg_wdir}.tmp.txt
wg_notify
fi
fi } fi }
export -f import_wg export -f import_wg