Skip to content
This repository was archived by the owner on Sep 13, 2020. It is now read-only.

Commit

Permalink
cleanup run_tor cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
jtschoonhoven committed Apr 30, 2020
1 parent c0caccd commit 4db0676
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.14
0.0.15
21 changes: 15 additions & 6 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ TOR_VER=0.3.5.9
TOR_SRC_NAME=tor-${TOR_VER}.tar.gz
TOR_DIST_URL=https://www.torproject.org/dist/


## --

set -euxo
Expand Down Expand Up @@ -56,6 +55,7 @@ if [ $TOR_IS_CACHED -eq 0 ] ; then
exit 1
fi
fi

################################################################################
# VERIFY INTEGRITY
################################################################################
Expand All @@ -69,6 +69,7 @@ if [ $TOR_IS_CACHED -eq 0 ] ; then
exit 1
fi
fi

################################################################################
# COMPILE
################################################################################
Expand All @@ -88,6 +89,7 @@ if [ $TOR_IS_CACHED -eq 0 ] ; then
exit 1
fi
fi

################################################################################
# INSTALL
################################################################################
Expand All @@ -99,19 +101,26 @@ echo "${TOR_SRC_NAME}" > $CACHE_DIR/tor_version.txt

cat > ${BUILD_DIR}/tor/bin/${RUN_COMMAND} <<EOF
#!/usr/bin/env bash
echo "Ensuring hidden_service directory"
mkdir -p "${HOME}/hidden_service"
echo "Setting up hidden service"
cat > ${HOME}/hidden_service/private_key <<EPK
echo "Ensuring hidden_service/private_key"
if [ ! -f "${HOME}/hidden_service/private_key" ]; then
cat > ${HOME}/hidden_service/private_key << EPK
\${HIDDEN_PRIVATE_KEY}
EPK
fi
echo \${HIDDEN_DOT_ONION} > ${HOME}/hidden_service/hostname
echo "Ensuring hidden_service/hostname"
if [ ! -f "${HOME}/hidden_service/hostname" ]; then
echo \${HIDDEN_DOT_ONION} > ${HOME}/hidden_service/hostname
fi
echo "Compiling torrc"
echo "Compiling torrc from config/torrc.erb"
erb config/torrc.erb > ${HOME}/tor/etc/tor/torrc
# Use -f to be safe here.
echo "Starting Tor"
$HOME/tor/bin/tor -f ${HOME}/tor/etc/tor/torrc
EOF

Expand Down

0 comments on commit 4db0676

Please sign in to comment.