import-mit-prüfung-der-Wireguard-Datei
This commit is contained in:
		
							
								
								
									
										17
									
								
								wire_g
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								wire_g
									
									
									
									
									
								
							@@ -79,17 +79,30 @@ import_wg(){
 | 
			
		||||
                 --width=1200 --height=800 \
 | 
			
		||||
                 --window-icon=${wg_pic}wg-import.png \
 | 
			
		||||
                 --title=$"Wireguard .conf Select file")
 | 
			
		||||
        then
 | 
			
		||||
        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
 | 
			
		||||
            else
 | 
			
		||||
            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 $"<b>Oh da ging etwas schief!</b> \n
 | 
			
		||||
<b>Keine gültige Wireguard Datei.</b> \n 
 | 
			
		||||
<b>Hier ein Beispiel:</b><span color='#0fad0a'><b>my_wireguard.conf</b></span> \n"  
 | 
			
		||||
                    import_wg
 | 
			
		||||
 | 
			
		||||
            fi
 | 
			
		||||
            ;;
 | 
			
		||||
        esac
 | 
			
		||||
    fi }
 | 
			
		||||
export -f import_wg
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user