stop wieder in wire_g kleinere fixes
This commit is contained in:
parent
35bccd9744
commit
b25e076046
@ -62,7 +62,7 @@ fi
|
|||||||
wait;
|
wait;
|
||||||
sudo mkdir -p /usr/share/icons/Arch-Symbole ; sudo cp icons/wg-vpn.png /usr/share/icons/Arch-Symbole/
|
sudo mkdir -p /usr/share/icons/Arch-Symbole ; sudo cp icons/wg-vpn.png /usr/share/icons/Arch-Symbole/
|
||||||
wait;
|
wait;
|
||||||
sudo cp wire_g wg_stop /sbin/ ; sudo chmod +x /sbin/wire_g ; sudo chmod +x /sbin/wg_stop
|
sudo cp wire_g /sbin/ ; sudo chmod +x /sbin/wire_g
|
||||||
wait; sudo cp Wire-G.desktop /usr/share/applications/
|
wait; sudo cp Wire-G.desktop /usr/share/applications/
|
||||||
echo
|
echo
|
||||||
case $LANG in
|
case $LANG in
|
||||||
|
@ -15,9 +15,7 @@ rm -f /home/"$USER"/.icons/wg-active.png wg-stop.png wg-vpn.png wg-import.png wg
|
|||||||
wait;
|
wait;
|
||||||
rm -r /home/"$USER"/.config/wg_nmcli
|
rm -r /home/"$USER"/.config/wg_nmcli
|
||||||
wait;
|
wait;
|
||||||
sudo rm /usr/share/icons/Arch-Symbole/wg-vpn.png
|
sudo rm /usr/share/icons/Arch-Symbole/wg-vpn.png ; sudo rm /sbin/wire_g
|
||||||
wait;
|
|
||||||
sudo rm /sbin/wire_g ; sudo rm /sbin/wg_stop
|
|
||||||
wait;
|
wait;
|
||||||
sudo rm /usr/share/applications/Wire-G.desktop ; sudo rm /usr/share/locale/de/LC_MESSAGES/wire-g.mo
|
sudo rm /usr/share/applications/Wire-G.desktop ; sudo rm /usr/share/locale/de/LC_MESSAGES/wire-g.mo
|
||||||
echo
|
echo
|
||||||
|
49
wg_stop
49
wg_stop
@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
# Wire-G App for simple management a Wireguard Tunnel ##
|
|
||||||
# Author: Désiré Werner Menrath ##
|
|
||||||
# Email: polunga40@unity-mail.de ##
|
|
||||||
# Translate German to English with LibreTranslate ##
|
|
||||||
# Translatefiles edit with Poedit ##
|
|
||||||
# Use without warranty! ##
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
Encoding=UTF-8
|
|
||||||
|
|
||||||
# i18n - Internationalization - Internationalisierung
|
|
||||||
|
|
||||||
export TEXTDOMAIN=wire-g
|
|
||||||
export TEXTDOMAINDIR="/usr/share/locale"
|
|
||||||
|
|
||||||
############################################################################################################
|
|
||||||
############################################################################################################
|
|
||||||
|
|
||||||
WG_WDIR="/home/$USER/.config/wg_nmcli/"
|
|
||||||
WG_PIC="/home/$USER/.icons/"
|
|
||||||
#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) )
|
|
||||||
#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)
|
|
||||||
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>"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) ) # Dies zeigt auf die richtige pid
|
|
||||||
kill $lines
|
|
||||||
|
|
||||||
################################# END ##################################################################
|
|
||||||
############################################################################################################
|
|
||||||
|
|
80
wire_g
80
wire_g
@ -31,9 +31,37 @@ nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR
|
|||||||
TUNNEL=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
TUNNEL=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
||||||
# Variable der aktiven TUNNELanzeige für Yad
|
# Variable der aktiven TUNNELanzeige für Yad
|
||||||
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
||||||
|
# Dies zeigt auf die richtige pid
|
||||||
|
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
|
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) )
|
||||||
|
#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)
|
||||||
|
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>"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) )
|
||||||
|
kill $lines
|
||||||
|
}
|
||||||
|
|
||||||
|
################################# END ##################################################################
|
||||||
|
############################################################################################################
|
||||||
|
|
||||||
wg_notify(){
|
wg_notify(){
|
||||||
|
|
||||||
@ -50,20 +78,21 @@ wg_notify(){
|
|||||||
--undecorated --borders=8 --skip-taskbar \
|
--undecorated --borders=8 --skip-taskbar \
|
||||||
--text-align=center --no-buttons --auto-close \
|
--text-align=center --no-buttons --auto-close \
|
||||||
--timeout 2 --timeout-indicator=bottom \
|
--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
|
# autoconnect wird hier abgeschalten damit auch neu importierte nach einem Systemneustart nicht aktiv sind
|
||||||
nmcli con mod "$ACTIVE" connection.autoconnect no
|
nmcli con mod "$ACTIVE" connection.autoconnect no
|
||||||
|
|
||||||
yad --notification \
|
yad --notification \
|
||||||
--image="${WG_PIC}wg-vpn.png" \
|
--image="${WG_PIC}wg-vpn.png" \
|
||||||
--icon-size=32 --no-middle \
|
--icon-size=32 --no-middle \
|
||||||
--text=$"$ACTIVE activ" \
|
--text=$"$ACTIVE activ" \
|
||||||
--menu="Wire-G $OPEN!/sbin/wire_g
|
--menu="Wire-G $OPEN!/sbin/wire_g
|
||||||
|$ACTIVE stop!/sbin/wg_stop" \
|
|$ACTIVE stop!/sbin/wg_stop" \
|
||||||
--command="menu" &
|
--command="menu" &
|
||||||
# Schreib die pid von Notify in
|
# Schreib die pid von Notify in
|
||||||
pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
|
pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
|
||||||
echo $pid > ${WG_WDIR}Notify_PID.txt
|
echo $pid > ${WG_WDIR}Notify_PID.txt
|
||||||
|
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,10 +106,10 @@ import_wg(){
|
|||||||
WG_PIC="/home/$USER/.icons/"
|
WG_PIC="/home/$USER/.icons/"
|
||||||
WG_WDIR="/home/$USER/.config/wg_nmcli/"
|
WG_WDIR="/home/$USER/.config/wg_nmcli/"
|
||||||
if WG_CONF=$(yad --file --separator=" \n" \
|
if WG_CONF=$(yad --file --separator=" \n" \
|
||||||
--button="OK" --button=$"Cancel" \
|
--button="OK" --button=$"Cancel" \
|
||||||
--width=1200 --height=800 --no-klick \
|
--width=1200 --height=800 --no-klick \
|
||||||
--window-icon=${WG_PIC}wg-import.png \
|
--window-icon=${WG_PIC}wg-import.png \
|
||||||
--title=$"Wireguard .conf Select file")
|
--title=$"Wireguard .conf Select file")
|
||||||
|
|
||||||
then
|
then
|
||||||
case "$WG_CONF" in
|
case "$WG_CONF" in
|
||||||
@ -94,7 +123,6 @@ import_wg(){
|
|||||||
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
|
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
|
||||||
wg_notify
|
wg_notify
|
||||||
else
|
else
|
||||||
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) ) # Dies zeigt auf die richtige pid
|
|
||||||
kill $lines
|
kill $lines
|
||||||
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
|
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
|
||||||
wg_notify
|
wg_notify
|
||||||
@ -109,7 +137,6 @@ import_wg(){
|
|||||||
import_wg ;;
|
import_wg ;;
|
||||||
esac
|
esac
|
||||||
fi }
|
fi }
|
||||||
export -f import_wg
|
|
||||||
|
|
||||||
# function end
|
# function end
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
@ -139,8 +166,7 @@ remove(){
|
|||||||
|
|
||||||
if [ "$SELECTION" = "$ACTIVE" ]
|
if [ "$SELECTION" = "$ACTIVE" ]
|
||||||
then
|
then
|
||||||
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}Notify_PID.txt) ) # Dies zeigt auf die richtige pid
|
kill $lines
|
||||||
kill $lines
|
|
||||||
fi }
|
fi }
|
||||||
|
|
||||||
# function end
|
# function end
|
||||||
@ -158,13 +184,11 @@ up_or_down(){
|
|||||||
--text=$"There is no active Tunnel that you could stop." \
|
--text=$"There is no active Tunnel that you could stop." \
|
||||||
--text-align=center --no-buttons \
|
--text-align=center --no-buttons \
|
||||||
--borders=8 --undecorated \
|
--borders=8 --undecorated \
|
||||||
--timeout 4 --timeout-indicator=bottom --skip-taskbar
|
--timeout 3 --timeout-indicator=bottom --skip-taskbar
|
||||||
else
|
else
|
||||||
wg_stop
|
wg_stop
|
||||||
wire_g
|
|
||||||
|
|
||||||
fi }
|
fi }
|
||||||
export -f up_or_down
|
|
||||||
|
|
||||||
# funktion end
|
# funktion end
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
@ -196,7 +220,6 @@ connect(){
|
|||||||
|
|
||||||
if SUCCESS=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${WG_WDIR}.tmp.txt)
|
if SUCCESS=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${WG_WDIR}.tmp.txt)
|
||||||
then
|
then
|
||||||
pkill yad
|
|
||||||
nmcli con mod $SELECTION connection.autoconnect no
|
nmcli con mod $SELECTION connection.autoconnect no
|
||||||
wg_notify
|
wg_notify
|
||||||
|
|
||||||
@ -210,10 +233,9 @@ connect(){
|
|||||||
SELECTION=$(yad --no-klick --list --center \
|
SELECTION=$(yad --no-klick --list --center \
|
||||||
--height=300 --width=60 --title="Wire-G" \
|
--height=300 --width=60 --title="Wire-G" \
|
||||||
--buttons-layout=center \
|
--buttons-layout=center \
|
||||||
--button=$"Start:0" --button=$"Stop":"bash -c up_or_down" \
|
--button=$"Start:0" --button=$"Stop:2" \
|
||||||
--button=$"Import":"bash -c import_wg" \
|
--button=$"Import:3" --button=$"Remove:4" \
|
||||||
--button=$"Remove:4" --separator="" \
|
--button=$"About:5" --separator="" \
|
||||||
--button=$"About:5" \
|
|
||||||
--window-icon=${WG_PIC}wg-vpn.png \
|
--window-icon=${WG_PIC}wg-vpn.png \
|
||||||
--borders=8 --image-on-top --image=${WG_PIC}wg-active.png \
|
--borders=8 --image-on-top --image=${WG_PIC}wg-active.png \
|
||||||
--column=$"Selection" $TUNNEL \
|
--column=$"Selection" $TUNNEL \
|
||||||
@ -225,6 +247,16 @@ RET=$?
|
|||||||
|
|
||||||
[[ $? -eq 1 ]] && exit 0
|
[[ $? -eq 1 ]] && exit 0
|
||||||
|
|
||||||
|
if [[ $RET -eq 2 ]]
|
||||||
|
then
|
||||||
|
wg_stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $RET -eq 3 ]]
|
||||||
|
then
|
||||||
|
import_wg
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $RET -eq 4 ]]
|
if [[ $RET -eq 4 ]]
|
||||||
then
|
then
|
||||||
remove
|
remove
|
||||||
|
Loading…
x
Reference in New Issue
Block a user