diff --git a/wire_g b/wire_g
index 2293ad7..0bf3d54 100755
--- a/wire_g
+++ b/wire_g
@@ -19,7 +19,7 @@ export TEXTDOMAINDIR="/usr/share/locale"
############################################################################################################
############################################################################################################
-version=3.0.9
+version=3.1.0
# Angemeldeten Benutzer ermitteln
a_user=$(whoami)
# wg_workdir Arbeitsverzeichnis wg
@@ -35,8 +35,7 @@ tunnel=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
############################################################################################################
-############################################################################################################
-# funktion wg_notify
+###############################wg_config.conf
wg_notify(){
@@ -74,36 +73,46 @@ import_wg(){
a_user=$(whoami)
wg_pic="/home/$a_user/.icons/"
wg_wdir="/home/$a_user/.config/wg_nmcli/"
- if wgconf=$(yad --file --separator=" \n" \
+ wgconf=$(yad --file --separator=" \n" \
--button="OK" --button=$"Cancel" \
--width=1200 --height=800 \
--window-icon=${wg_pic}wg-import.png \
--title=$"Wireguard .conf Select file")
- 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
- 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 }
+ case "$wgconf" in
+
+ *_*.conf) if grep -i 'PEER\|PublicKey' wg_config.conf > /dev/null && grep -i 'Interface\|PrivateKey' wg_config.conf > /dev/null
+ then
+ active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
+ if [[ -n $active ]]
+ then
+ wg_stop
+ nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt
+ wg_notify
+
+ elif [[ -z $active ]]
+ then
+ nmcli connection import type wireguard file $wgconf &> ${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
+ fi ;;
+ *) 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 ;;
+ esac }
export -f import_wg
# function end
@@ -185,7 +194,7 @@ export -f up_or_down
more(){
a_user=$(whoami)
wg_pic="/home/$a_user/.icons/"
- version=3.0.9
+ version=3.1.0
selection=$(yad --height=100 --width=80 \
--title="Wire-G" --center \
--fixed --borders=8 --close-on-unfocus \
@@ -197,7 +206,7 @@ more(){
--text=$"Wire-G Author: Désiré Werner Menrath \n
E-Mail: polunga40@unity-mail.de \n
At all tunnels, the auto start is disabled. \n
-Version: $version \n
+Version: "$version" \n
Use without warranty. \n
Download Wire-G \n")