txt Dateien umbenannt und kleine fixes
This commit is contained in:
		
							
								
								
									
										26
									
								
								wire_g
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								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=$"<span color='#0fad0a'><b>"$VALUE" Connection</b></span><span>  <b>disconnected</b></span>" | ||||
|                   --text=$"<span color='#0fad0a'><b>"$VALUE" Connection</b></span><span>" "<b>disconnected</b></span>" | ||||
|       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=$"<span color='#0fad0a'><b>"$ACTIVE"</b></span>  <span><b>powered</b></span>" & | ||||
|             --text=$"<span color='#0fad0a'><b>"$ACTIVE"</b></span>" "<span><b>powered</b></span>" & | ||||
|     # 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(){  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user