import-mit-prüfung-der-Wireguard-Datei

This commit is contained in:
Désiré Werner Menrath 2023-11-06 21:34:42 +01:00
parent 925a358fca
commit c57279d868

17
wire_g
View File

@ -79,17 +79,30 @@ import_wg(){
--width=1200 --height=800 \
--window-icon=${wg_pic}wg-import.png \
--title=$"Wireguard .conf Select file")
then
case $wgconf in
*.conf && *_*.conf)
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
if [[ -n $active ]]
then
wg_stop
nmcli connection import type wireguard file $wgconf 2> ${wg_wdir}.tmp.txt
wg_notify
else
elif [[ -z $active ]]
then
nmcli connection import type wireguard file $wgconf 2> ${wg_wdir}.tmp.txt
wg_notify
else
yad --text-align=center --button=$"OK" --title=$"Wireguard .conf Select file" \
--image-on-top --image=${wg_pic}wg-info.png \
--fixed --center --buttons-layout=center --borders=8 \
--text $"<b>Oh da ging etwas schief!</b> \n
<b>Keine gültige Wireguard Datei.</b> \n
<b>Hier ein Beispiel:</b><span color='#0fad0a'><b>my_wireguard.conf</b></span> \n"
import_wg
fi
;;
esac
fi }
export -f import_wg