From 209f8b732fa83d856c516f48b81b1541f9fb8b81 Mon Sep 17 00:00:00 2001 From: punix Date: Thu, 16 Nov 2023 17:27:05 +0100 Subject: [PATCH] txt Dateien umbenannt und kleine fixes --- wire_g | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wire_g b/wire_g index 1968d8f..6a3aaed 100755 --- a/wire_g +++ b/wire_g @@ -25,8 +25,8 @@ WG_WDIR="/home/$USER/.config/wg_nmcli/" # Pfad wg Icons WG_PIC="/home/$USER/.icons/" # Wireguard TUNNEL auslesen mit grep nur Wireguard zeigen -# mit sed alles nach dem ersten Leerzeichen bis Zeilenende weggeschneiden und .TUNNEL.txt schreiben -nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR}.TUNNEL.txt +# mit sed alles nach dem ersten Leerzeichen bis Zeilenende weggeschneiden und tunnel.txt schreiben +nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR}tunnel.txt # Variable der verfügbaren TUNNELanzeige für Yad TUNNEL=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') # Variable der aktiven TUNNELanzeige für Yad @@ -38,29 +38,29 @@ ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ wg_stop(){ #Dieser befehl ist notwendig da nach dem import (erster Start) gestartete Tunnel nicht in der .tunnel Datei stehen. - nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR}.tunnel.txt - #Damit wird der inhalt von /home/$USER/.config/wg_nmcli/.tunnel.txt in ein Array gespeichert - IFS=$'\n' lines=( $(cat ${WG_WDIR}.tunnel.txt) ) + nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR}tunnel.txt + #Damit wird der inhalt von /home/$USER/.config/wg_nmcli/tunnel.txt in ein Array gespeichert + IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) ) #echo ${lines[0]} #Damit wird der Inhalt ausgelesen. (Index angeben) VALUE=$"*_*" for VALUE in "${lines[@]}" do # hier wird die Ausgabe von nmcli für die auswertung in die .stop.txt gespeichert nmcli connection down "$VALUE" &> ${WG_WDIR}.stop.txt - if disable=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt) + if DISABLE=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt) then yad --image-on-top --image=${WG_PIC}wg-info.png \ --undecorated --borders=8 --skip-taskbar \ --text-align=center --no-buttons \ --timeout 2 --timeout-indicator=bottom \ - --text=$""$VALUE" Connection disconnected" + --text=$""$VALUE" Connection" "disconnected" fi done - IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) ) + IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}for-kill_pid.txt) ) kill $lines } -################################# END ################################################################## +############################################################################################################ ############################################################################################################ wg_notify(){ @@ -78,7 +78,7 @@ wg_notify(){ --undecorated --borders=8 --skip-taskbar \ --text-align=center --no-buttons --auto-close \ --timeout 2 --timeout-indicator=bottom \ - --text=$""$ACTIVE" powered" & + --text=$""$ACTIVE"" "powered" & # autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind nmcli con mod "$ACTIVE" connection.autoconnect no @@ -91,8 +91,8 @@ wg_notify(){ --command="menu" & # Schreib die pid von Notify in pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') - echo $pid > ${WG_WDIR}Notify_PID.txt - IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) ) + echo $pid > ${WG_WDIR}for-kill_pid.txt + IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}for-kill_pid.txt) ) # awk '{print $2}' heist, zeig mir nur die zweite Nummer an } @@ -193,7 +193,7 @@ up_or_down(){ # funktion end ############################################################################################################ ############################################################################################################ -# function button "more" +# function button "about" about(){