Ensure that v2 onion address flag gets cleared on each call

This commit is contained in:
Bob Mottram 2018-02-23 11:49:00 +00:00
parent 3e03e30fd2
commit 5b782e51fd
1 changed files with 4 additions and 1 deletions

View File

@ -116,11 +116,13 @@ function add_onion_service {
if [ -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then if [ -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then
echo $(cat ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname) echo $(cat ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname)
USE_V2_ONION_ADDRESS=
return return
fi fi
if [ ! -d /var/lib/tor ]; then if [ ! -d /var/lib/tor ]; then
echo $"No Tor installation found. ${onion_service_name} onion site cannot be configured." echo $"No Tor installation found. ${onion_service_name} onion site cannot be configured."
USE_V2_ONION_ADDRESS=
exit 877367 exit 877367
fi fi
if ! grep -q "hidden_service_${onion_service_name}" /etc/tor/torrc; then if ! grep -q "hidden_service_${onion_service_name}" /etc/tor/torrc; then
@ -129,7 +131,6 @@ function add_onion_service {
echo 'HiddenServiceVersion 3' >> /etc/tor/torrc echo 'HiddenServiceVersion 3' >> /etc/tor/torrc
else else
echo 'HiddenServiceVersion 2' >> /etc/tor/torrc echo 'HiddenServiceVersion 2' >> /etc/tor/torrc
USE_V2_ONION_ADDRESS=
fi fi
echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
if [ ${#onion_stealth_name} -gt 0 ]; then if [ ${#onion_stealth_name} -gt 0 ]; then
@ -137,6 +138,8 @@ function add_onion_service {
fi fi
fi fi
USE_V2_ONION_ADDRESS=
onion_update onion_update
function_check wait_for_onion_service function_check wait_for_onion_service