|
@@ -50,21 +50,11 @@ function onion_update {
|
50
|
50
|
systemctl restart tor
|
51
|
51
|
}
|
52
|
52
|
|
53
|
|
-function onion_service_exists {
|
54
|
|
- onion_service_name="$1"
|
55
|
|
-
|
56
|
|
- if [ -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
57
|
|
- echo -n "1"
|
58
|
|
- else
|
59
|
|
- echo -n "0"
|
60
|
|
- fi
|
61
|
|
-}
|
62
|
|
-
|
63
|
53
|
function wait_for_onion_service_base {
|
64
|
54
|
onion_service_name="$1"
|
65
|
55
|
|
66
|
56
|
sleep_ctr=0
|
67
|
|
- while [[ $(onion_service_exists ${onion_service_name}) == "0" ]]; do
|
|
57
|
+ while [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; do
|
68
|
58
|
sleep 1
|
69
|
59
|
sleep_ctr=$((sleep_ctr + 1))
|
70
|
60
|
if [ $sleep_ctr -gt 10 ]; then
|
|
@@ -78,7 +68,7 @@ function wait_for_onion_service {
|
78
|
68
|
|
79
|
69
|
wait_for_onion_service_base ${onion_service_name}
|
80
|
70
|
|
81
|
|
- if [[ $(onion_service_exists ${onion_service_name}) == "0" ]]; then
|
|
71
|
+ if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
82
|
72
|
# try a second time
|
83
|
73
|
onion_update
|
84
|
74
|
wait_for_onion_service_base ${onion_service_name}
|
|
@@ -123,8 +113,8 @@ function add_onion_service {
|
123
|
113
|
onion_service_port_to=$3
|
124
|
114
|
onion_stealth_name="$4"
|
125
|
115
|
|
126
|
|
- if [[ $(onion_service_exists ${onion_service_name}) == "1" ]]; then
|
127
|
|
- cat /var/lib/tor/hidden_service_${onion_service_name}/hostname
|
|
116
|
+ if [ -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
|
117
|
+ echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
|
128
|
118
|
return
|
129
|
119
|
fi
|
130
|
120
|
|
|
@@ -145,7 +135,7 @@ function add_onion_service {
|
145
|
135
|
function_check wait_for_onion_service
|
146
|
136
|
wait_for_onion_service ${onion_service_name}
|
147
|
137
|
|
148
|
|
- if [[ $(onion_service_exists ${onion_service_name}) == "0" ]]; then
|
|
138
|
+ if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
149
|
139
|
echo $"${onion_service_name} onion site hostname not found"
|
150
|
140
|
exit 763624
|
151
|
141
|
fi
|