Bob Mottram 8 years ago
parent
commit
d441d19470
1 changed files with 10 additions and 5 deletions
  1. 10
    5
      src/freedombone-utils-onion

+ 10
- 5
src/freedombone-utils-onion View File

@@ -28,6 +28,11 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+function onion_update {
32
+    # update so that new onion services appear
33
+    systemctl reload tor
34
+}
35
+
31 36
 function onion_service_exists {
32 37
     onion_service_name="$1"
33 38
 
@@ -57,8 +62,8 @@ function wait_for_onion_service {
57 62
     wait_for_onion_service_base ${onion_service_name}
58 63
 
59 64
     if [ $(onion_service_exists ${onion_service_name}) == "0" ]; then
60
-        # reload and try a second time
61
-        systemctl reload tor
65
+        # try a second time
66
+        onion_update
62 67
         wait_for_onion_service_base ${onion_service_name}
63 68
     fi
64 69
 }
@@ -81,7 +86,7 @@ function remove_onion_service {
81 86
         shred -zu /var/lib/tor/hidden_service_${onion_service_name}/*
82 87
         rm -rf /var/lib/tor/hidden_service_${onion_service_name}
83 88
     fi
84
-    systemctl reload tor
89
+    onion_update
85 90
 }
86 91
 
87 92
 function add_onion_service {
@@ -103,7 +108,7 @@ function add_onion_service {
103 108
         echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
104 109
     fi
105 110
 
106
-    systemctl reload tor
111
+    onion_update
107 112
 
108 113
     function_check wait_for_onion_service
109 114
     wait_for_onion_service ${onion_service_name}
@@ -252,7 +257,7 @@ function resolve_dns_via_tor {
252 257
         echo 'DNSPort 53' >> /etc/tor/torrc
253 258
         echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
254 259
         echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc
255
-        systemctl reload tor
260
+        onion_update
256 261
     fi
257 262
 
258 263
     # don't change resolv.conf