From c57279d868cdb504e11098252eec76b7be2a7287 Mon Sep 17 00:00:00 2001 From: punix Date: Mon, 6 Nov 2023 21:34:42 +0100 Subject: [PATCH] =?UTF-8?q?import-mit-pr=C3=BCfung-der-Wireguard-Datei?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wire_g | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/wire_g b/wire_g index 17967dc..2293ad7 100755 --- a/wire_g +++ b/wire_g @@ -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 $"Oh da ging etwas schief! \n +Keine gültige Wireguard Datei. \n +Hier ein Beispiel:my_wireguard.conf \n" + import_wg + fi + ;; + esac fi } export -f import_wg