Switch mesh vpn connection to zenity

This commit is contained in:
Bob Mottram 2017-12-06 21:17:50 +00:00
parent 7cb7225c2f
commit 504c561ea3
1 changed files with 8 additions and 25 deletions

View File

@ -152,8 +152,7 @@ function mesh_setup_vpn {
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/vpn.tar.gz
if [ -f vpn.tar.gz ]; then
dialog --title $"Generate VPN client keys" \
--msgbox $"\nNew VPN client keys have been generated in the /home/fbone directory.\n\nYou can find it by selecting \"Places\" then \"Home Directory\" on the top menu bar. Transmit the vpn.tar.gz file to whoever is running the other mesh network so that they can connect to yours.\n\nThey should uncompress vpn.tar.gz to their /home/fbone directory, forward port $VPN_MESH_TLS_PORT then connect using your IP address or domain name." 15 70
zenity --info --title $"Generate VPN client keys" --text $"\nNew VPN client keys have been generated in the /home/fbone directory.\n\nYou can find it by selecting \"Places\" then \"Home Directory\" on the top menu bar. Transmit the vpn.tar.gz file to whoever is running the other mesh network so that they can connect to yours.\n\nThey should uncompress vpn.tar.gz to their /home/fbone directory, forward port $VPN_MESH_TLS_PORT then connect using your IP address or domain name." --width 600
fi
}
@ -164,15 +163,11 @@ function connect_to_mesh {
connect_title=$"Connect from $(cat $HIDDEN_SERVICE_PATH) to another mesh network"
fi
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title "$connect_title" \
--backtitle $"Freedombone Mesh" \
--inputbox $'Enter the IP address or domain name of the other mesh.' 10 60 2>$data
data=$(zenity --entry --title "$connect_title" --text $'Enter the IP address or domain name of the other mesh')
sel=$?
case $sel in
0)
ip_or_domain=$(<$data)
ip_or_domain="$data"
if [ ${#ip_or_domain} -gt 1 ]; then
if [[ "$ip_or_domain" == *'.'* ]]; then
@ -188,9 +183,7 @@ function connect_to_mesh {
fi
if [ $connect_failed ]; then
dialog --title $"Connect to another mesh network" \
--msgbox $"\nObtain the vpn.tar.gz file from the other mesh administrator, uncompress it into the /home/fbone directory and also forwarded port $VPN_MESH_TLS_PORT from your internet router to this system." 10 50
rm $data
zenity --info --title $"Connect to another mesh network" --text $"\nObtain the vpn.tar.gz file from the other mesh administrator, uncompress it into the /home/fbone directory and also forwarded port $VPN_MESH_TLS_PORT from your internet router to this system." --width 400
exit 1
fi
@ -204,27 +197,17 @@ function connect_to_mesh {
fi
;;
esac
rm $data
}
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Mesh" \
--title $"Connect to another mesh network" \
--radiolist $"Choose an operation:" 10 75 2 \
1 $"Connect to another mesh network" on \
2 $"Generate VPN keys for another mesh network to connect to me" off 2> $data
data=$(zenity --list 1 $"Connect to another mesh network" 2 $"Generate VPN keys for another mesh network to connect to me" --column="id" --title $"Connect to another mesh network" --column=$"Choose an operation:" --hide-column=1 --print-column=1 --width=500 --height=100)
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
case $(cat $data) in
1) rm $data
connect_to_mesh;;
2) rm $data
mesh_setup_vpn;;
case $data in
1) connect_to_mesh;;
2) mesh_setup_vpn;;
esac
exit 0