From 6575c2a4d9e6064516cec6802705e5cced4806ec Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 6 Jan 2016 16:33:32 +0000 Subject: [PATCH] git onion port --- src/freedombone | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/freedombone b/src/freedombone index 5fe273c5..1d0bd2db 100755 --- a/src/freedombone +++ b/src/freedombone @@ -6708,7 +6708,21 @@ quit" > $INSTALL_DIR/batch.sql nginx_ensite $GIT_DOMAIN_NAME - GIT_ONION_HOSTNAME=$(add_onion_service gogs 80 ${GIT_ONION_PORT}) + if [ ! -d /var/lib/tor ]; then + echo $'No Tor installation found. Gogs onion site cannot be configured.' + exit 877367 + fi + if ! grep -q "hidden_service_gogs" /etc/tor/torrc; then + echo 'HiddenServiceDir /var/lib/tor/hidden_service_gogs/' >> /etc/tor/torrc + echo "HiddenServicePort ${GIT_ONION_HOSTNAME} 127.0.0.1:${GIT_ONION_HOSTNAME}" >> /etc/tor/torrc + echo "HiddenServicePort 9418 127.0.0.1:9418" >> /etc/tor/torrc + echo $'Added onion site for Gogs' + fi + + systemctl restart tor + sleep 8 + + GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname) systemctl restart php5-fpm systemctl restart nginx @@ -6719,7 +6733,9 @@ quit" > $INSTALL_DIR/batch.sql chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README chmod 600 /home/$MY_USERNAME/README fi - echo "Gogs onion domain:${GIT_ONION_HOSTNAME}" >> $COMPLETION_FILE + if ! grep -q "Gogs onion domain" $COMPLETION_FILE; then + echo "Gogs onion domain:${GIT_ONION_HOSTNAME}" >> $COMPLETION_FILE + fi # update the dynamic DNS CURRENT_DDNS_DOMAIN=$GIT_DOMAIN_NAME