ソースを参照

Switch mesh vpn connection to zenity

Bob Mottram 7 年 前
コミット
504c561ea3
共有1 個のファイルを変更した8 個の追加25 個の削除を含む
  1. 8
    25
      src/freedombone-mesh-connect

+ 8
- 25
src/freedombone-mesh-connect ファイルの表示

152
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/vpn.tar.gz
152
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/vpn.tar.gz
153
 
153
 
154
     if [ -f vpn.tar.gz ]; then
154
     if [ -f vpn.tar.gz ]; then
155
-        dialog --title $"Generate VPN client keys" \
156
-               --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
155
+        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
157
     fi
156
     fi
158
 }
157
 }
159
 
158
 
164
         connect_title=$"Connect from $(cat $HIDDEN_SERVICE_PATH) to another mesh network"
163
         connect_title=$"Connect from $(cat $HIDDEN_SERVICE_PATH) to another mesh network"
165
     fi
164
     fi
166
 
165
 
167
-    data=$(tempfile 2>/dev/null)
168
-    trap "rm -f $data" 0 1 2 5 15
169
-    dialog --title "$connect_title" \
170
-           --backtitle $"Freedombone Mesh" \
171
-           --inputbox $'Enter the IP address or domain name of the other mesh.' 10 60 2>$data
166
+    data=$(zenity --entry --title "$connect_title" --text $'Enter the IP address or domain name of the other mesh')
172
     sel=$?
167
     sel=$?
173
     case $sel in
168
     case $sel in
174
         0)
169
         0)
175
-            ip_or_domain=$(<$data)
170
+            ip_or_domain="$data"
176
             if [ ${#ip_or_domain} -gt 1 ]; then
171
             if [ ${#ip_or_domain} -gt 1 ]; then
177
                 if [[ "$ip_or_domain" == *'.'* ]]; then
172
                 if [[ "$ip_or_domain" == *'.'* ]]; then
178
 
173
 
188
                     fi
183
                     fi
189
 
184
 
190
                     if [ $connect_failed ]; then
185
                     if [ $connect_failed ]; then
191
-                        dialog --title $"Connect to another mesh network" \
192
-                               --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
193
-                        rm $data
186
+                        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
194
                         exit 1
187
                         exit 1
195
                     fi
188
                     fi
196
 
189
 
204
             fi
197
             fi
205
             ;;
198
             ;;
206
     esac
199
     esac
207
-
208
-    rm $data
209
 }
200
 }
210
 
201
 
211
-data=$(tempfile 2>/dev/null)
212
-trap "rm -f $data" 0 1 2 5 15
213
-dialog --backtitle $"Freedombone Mesh" \
214
-       --title $"Connect to another mesh network" \
215
-       --radiolist $"Choose an operation:" 10 75 2 \
216
-       1 $"Connect to another mesh network" on \
217
-       2 $"Generate VPN keys for another mesh network to connect to me" off 2> $data
202
+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)
218
 sel=$?
203
 sel=$?
219
 case $sel in
204
 case $sel in
220
     1) exit 1;;
205
     1) exit 1;;
221
     255) exit 1;;
206
     255) exit 1;;
222
 esac
207
 esac
223
-case $(cat $data) in
224
-    1) rm $data
225
-       connect_to_mesh;;
226
-    2) rm $data
227
-       mesh_setup_vpn;;
208
+case $data in
209
+    1) connect_to_mesh;;
210
+    2) mesh_setup_vpn;;
228
 esac
211
 esac
229
 
212
 
230
 exit 0
213
 exit 0