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}"