kleine fix
This commit is contained in:
parent
ecd8990ebc
commit
b658792c9a
33
wire_g
33
wire_g
@ -44,7 +44,7 @@ wg_notify(){
|
||||
wg_pic="/home/$a_user/.icons/"
|
||||
notify-send --icon=${wg_pic}wg-vpn.png $"$active powered"
|
||||
# autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind
|
||||
nmcli con mod $active connection.autoconnect no
|
||||
nmcli con mod "$active" connection.autoconnect no
|
||||
# ab hier beginnt yad notify
|
||||
#Pipe erstellen
|
||||
PIPE="$HOME/.pipe.tmp"
|
||||
@ -81,18 +81,18 @@ import_wg(){
|
||||
|
||||
case "$wgconf" in
|
||||
|
||||
*_*.conf) if grep -i 'PEER\|PublicKey' wg_config.conf > /dev/null && grep -i 'Interface\|PrivateKey' wg_config.conf > /dev/null
|
||||
*_*.conf) if grep -i 'PEER\|PublicKey' "$wgconf" > /dev/null && grep -i 'Interface\|PrivateKey' "$wgconf" > /dev/null
|
||||
then
|
||||
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
||||
if [[ -n $active ]]
|
||||
if [[ -n "$active" ]]
|
||||
then
|
||||
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
|
||||
|
||||
elif [[ -z $active ]]
|
||||
elif [[ -z "$active" ]]
|
||||
then
|
||||
nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt
|
||||
nmcli connection import type wireguard file "$wgconf" &> ${wg_wdir}.tmp.txt
|
||||
wg_notify
|
||||
|
||||
else
|
||||
@ -134,20 +134,19 @@ remove(){
|
||||
--fixed --buttons-layout=center --separator="" \
|
||||
--button=$"OK" --button=$"Cancel" \
|
||||
--borders=8 --image-on-top --image=${wg_pic}wg-active.png \
|
||||
--column=$"Delete" $tunnel \
|
||||
--column=$"Delete" "$tunnel" \
|
||||
--text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$active</b></span>
|
||||
<b>----------------------------------------------------------------------------------</b>
|
||||
<b>If no tunnels are listed,</b>
|
||||
<b>so they have to import their tunnel beforehand.</b>")
|
||||
|
||||
then
|
||||
nmcli connection delete $selection &> ${wg_wdir}.tmp.txt
|
||||
success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
|
||||
if [ "$?" = "0" ]
|
||||
nmcli connection delete "$selection" &> ${wg_wdir}.tmp.txt
|
||||
if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
|
||||
then
|
||||
yad --window-icon=${wg_pic}wg-trash.png \
|
||||
--image-on-top --image=${wg_pic}wg-info.png \
|
||||
--text=$"Your tunnel $selection was successfully deleted." \
|
||||
--text=$"Your tunnel "$selection" was successfully deleted." \
|
||||
--text-align=center --button=$"OK" --title "Wire-G Trash" \
|
||||
--fixed --center --buttons-layout=center --borders=8 --center
|
||||
else
|
||||
@ -157,7 +156,7 @@ remove(){
|
||||
--text-align=center --button=$"OK" --title "Wire-G Trash" \
|
||||
--fixed --center --buttons-layout=center --borders=8 --center
|
||||
fi
|
||||
if [ $selection = $active ]
|
||||
if [ "$selection" = "$active" ]
|
||||
then
|
||||
pkill wire_g
|
||||
pkill yad
|
||||
@ -222,7 +221,7 @@ connect(){
|
||||
|
||||
if success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt)
|
||||
then
|
||||
nmcli con mod $selection connection.autoconnect no
|
||||
nmcli con mod "$selection" connection.autoconnect no
|
||||
wg_notify
|
||||
fi }
|
||||
|
||||
@ -239,7 +238,7 @@ if selection=$(yad --no-click --list \
|
||||
--button=$"More":"bash -c more" --button=$"Remove":"bash -c remove" --separator="" \
|
||||
--window-icon=${wg_pic}wg-vpn.png \
|
||||
--borders=8 --image-on-top --image=${wg_pic}wg-active.png \
|
||||
--column=$"Selection" $tunnel \
|
||||
--column=$"Selection" "$tunnel" \
|
||||
--text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$active</b></span>
|
||||
<b>----------------------------------------------------------------------------------</b>
|
||||
<b>If no tunnels are listed,</b>
|
||||
@ -247,13 +246,13 @@ if selection=$(yad --no-click --list \
|
||||
|
||||
then
|
||||
|
||||
if [[ -n $active ]]
|
||||
if [[ -n "$active" ]]
|
||||
then
|
||||
wg_stop
|
||||
nmcli connection up $selection &> ${wg_wdir}.tmp.txt
|
||||
nmcli connection up "$selection" &> ${wg_wdir}.tmp.txt
|
||||
connect
|
||||
else
|
||||
nmcli connection up $selection &> ${wg_wdir}.tmp.txt
|
||||
nmcli connection up "$selection" &> ${wg_wdir}.tmp.txt
|
||||
connect
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user