if's angepasst
This commit is contained in:
parent
f33164dd92
commit
da972a958a
12
wire_g
12
wire_g
@ -57,12 +57,11 @@ import_wg(){
|
||||
a_user=$(whoami)
|
||||
wg_pic="/home/$a_user/.icons/"
|
||||
wg_wdir="/home/$a_user/.config/wg_nmcli/"
|
||||
wgconf=$(yad --file --separator=" \n" \
|
||||
if 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")
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
||||
if [[ -n $active ]]
|
||||
@ -90,13 +89,12 @@ remove(){
|
||||
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${wg_wdir}.wg_noactive.txt
|
||||
active=$(cat ${wg_wdir}.wg_noactive.txt)
|
||||
|
||||
selection=$(yad --no-click --list --height=300 --width=60 \
|
||||
if selection=$(yad --no-click --list --height=300 --width=60 \
|
||||
--title="Wire-G Trash" --center \
|
||||
--fixed --buttons-layout=center \
|
||||
--button="OK" --button="Cancel" \
|
||||
--separator="" --window-icon=${wg_pic}wg-trash.png \
|
||||
--borders=8 --column 'Delete' $tunnel)
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
nmcli connection delete $selection &> ${wg_wdir}.tmp.txt
|
||||
success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
|
||||
@ -174,8 +172,7 @@ export -f more
|
||||
|
||||
connect(){
|
||||
|
||||
success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt)
|
||||
if [ "$?" = "0" ]
|
||||
if success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt)
|
||||
then
|
||||
nmcli con mod $selection connection.autoconnect no
|
||||
wg_notify
|
||||
@ -186,7 +183,7 @@ connect(){
|
||||
############################################################################################################ # --text "<b>Aktiver Tunnel:</b> <span color='#0fad0a'><b>$active</b></span> # mit <b>gewünschtes wort</b> wird fett geschrieben.
|
||||
# Farbe für Variable $active festgelegt mit fetter Schrift. (bei --text zwischen " ")
|
||||
|
||||
selection=$(yad --no-click --list \
|
||||
if selection=$(yad --no-click --list \
|
||||
--close-on-unfocus --center \
|
||||
--height=300 --width=60 --title="Wire-G" \
|
||||
--fixed --buttons-layout=center \
|
||||
@ -199,7 +196,6 @@ selection=$(yad --no-click --list \
|
||||
<b>If no tunnels are listed,</b>
|
||||
<b>so they have to import their tunnel beforehand.</b>" \
|
||||
--column 'Selection' $tunnel)
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
|
||||
if [[ -n $active ]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user