~ekez/negativefour

2d8c12dfa0a1c21bfa5b5e12c5adf57f5bbdd2e6 — Zeke Medley 1 year, 8 months ago 640a68f
Stop undeploy script from removing all newlines from torrc
1 files changed, 8 insertions(+), 3 deletions(-)

M serve/undeploy.sh
M serve/undeploy.sh => serve/undeploy.sh +8 -3
@@ 29,9 29,14 @@ PORT=$(head -1 /etc/apache2/sites-available/${URL}.conf | awk 'NF>1{print $NF}')

rm -rf "/home/admin/www/html/$URL"

REMOVED=$(grep -v "HiddenServiceDir /var/lib/tor/${URL}" /etc/tor/torrc | grep -v "HiddenServicePort 80 127.0.0.1:${PORT}")

echo $REMOVED > /etc/tor/torrc
# This dance is needed as for whatever reason piping the output of
# grep into a variable replaces the newlines with spaces so we need to
# pipe into a file and move it around.
grep -v "HiddenServiceDir /var/lib/tor/${URL}" /etc/tor/torrc > tmpfile
grep -v "HiddenServicePort 80 127.0.0.1:${PORT}" tmpfile > tmpfile2
rm tmpfile

mv tmpfile2 /etc/tor/torrc

rm -rf "/var/lib/tor/${URL}"