diff --git a/src/freedombone-mesh-connect b/src/freedombone-mesh-connect index ab38bccb..39e39c73 100755 --- a/src/freedombone-mesh-connect +++ b/src/freedombone-mesh-connect @@ -157,20 +157,10 @@ function mesh_setup_vpn { fi } -function connect_to_vpn { - dialog --title $"VPN Connect to another mesh network" \ - --backtitle $"Freedombone Mesh" \ - --defaultno \ - --yesno $"\nHave you received the vpn.tar.gz file from the other mesh administrator, uncompressed it into the /home/fbone directory and also forwarded port $VPN_MESH_TLS_PORT from your internet router to this system?" 10 70 - sel=$? - case $sel in - 1) return;; - 255) return;; - esac - +function connect_to_mesh { data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 - dialog --title $"VPN Connect to another mesh network" \ + dialog --title $"Connect to another mesh network" \ --backtitle $"Freedombone Mesh" \ --inputbox $'Enter the IP address or domain name of the other mesh.' 10 60 2>$data sel=$? @@ -180,15 +170,20 @@ function connect_to_vpn { if [ ${#ip_or_domain} -gt 1 ]; then if [[ "$ip_or_domain" == *'.'* ]]; then + connect_failed= if [ ! -f ~/client.ovpn ]; then - rm $data - exit 1 + connect_failed=1 fi if [ ! -f ~/stunnel.pem ]; then - rm $data - exit 1 + connect_failed=1 fi if [ ! -f ~/stunnel.p12 ]; then + connect_failed=1 + 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 exit 1 fi @@ -221,7 +216,7 @@ case $sel in esac case $(cat $data) in 1) rm $data - connect_to_vpn;; + connect_to_mesh;; 2) rm $data mesh_setup_vpn;; esac