remove 6 test
This commit is contained in:
		
							
								
								
									
										17
									
								
								wire_g
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								wire_g
									
									
									
									
									
								
							@@ -115,22 +115,10 @@ export -f import_wg
 | 
				
			|||||||
# funktion wireguard remove
 | 
					# funktion wireguard remove
 | 
				
			||||||
 | 
					
 | 
				
			||||||
remove(){ 
 | 
					remove(){ 
 | 
				
			||||||
    a_user=$(whoami)
 | 
					  
 | 
				
			||||||
    wg_pic="/home/$a_user/.icons/"
 | 
					 | 
				
			||||||
    wg_wdir="/home/$a_user/.config/wg_nmcli/"
 | 
					 | 
				
			||||||
    tunnel=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/  .*//')
 | 
					 | 
				
			||||||
    nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/  .*//' &> ${wg_wdir}.wg_noactive.txt
 | 
					    nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/  .*//' &> ${wg_wdir}.wg_noactive.txt
 | 
				
			||||||
    active=$(cat ${wg_wdir}.wg_noactive.txt)
 | 
					    active=$(cat ${wg_wdir}.wg_noactive.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if selection=$(yad --no-click --list --center \
 | 
					 | 
				
			||||||
                --window-icon=${wg_pic}wg-trash.png \
 | 
					 | 
				
			||||||
                --height=200 --width=60 --undecorated \
 | 
					 | 
				
			||||||
                --buttons-layout=center --separator="" \
 | 
					 | 
				
			||||||
                --button=$"OK" --button=$"Cancel" \
 | 
					 | 
				
			||||||
                --borders=8 \
 | 
					 | 
				
			||||||
                --column=$"Delete" $tunnel)   
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        then
 | 
					 | 
				
			||||||
            nmcli connection delete $selection &> ${wg_wdir}.tmp.txt 
 | 
					            nmcli connection delete $selection &> ${wg_wdir}.tmp.txt 
 | 
				
			||||||
            if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
 | 
					            if success=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${wg_wdir}.tmp.txt)
 | 
				
			||||||
                then 
 | 
					                then 
 | 
				
			||||||
@@ -151,8 +139,7 @@ remove(){
 | 
				
			|||||||
            if [ "$selection" = "$active" ]
 | 
					            if [ "$selection" = "$active" ]
 | 
				
			||||||
                then
 | 
					                then
 | 
				
			||||||
                    pkill yad
 | 
					                    pkill yad
 | 
				
			||||||
            fi
 | 
					            fi } 
 | 
				
			||||||
     fi } 
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# function end
 | 
					# function end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user