aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2013-06-05 15:48:57 +0200
committerLinus Nordberg <linus@torproject.org>2013-06-08 15:31:56 +0200
commit933e49a8b29232d4dc2d430b25868ca0ffea6caf (patch)
tree3e64af6fbdcbae36fc4c03d3ef2d07a7fe1dfa15 /tools
parent2ce7c427d1e916b083c81781a17beb35dc5713e2 (diff)
downloadchutney-933e49a8b29232d4dc2d430b25868ca0ffea6caf.tar
chutney-933e49a8b29232d4dc2d430b25868ca0ffea6caf.tar.gz
Use new Tor option TestingV3AuthVotingStartOffset to bootstrap quicker.
Note that this match makes us require Tor with support for TestingV3AuthVotingStartOffset, something which is not in any released Tor yet. Note also that the way TestingV3AuthVotingStartOffset is set in the torrc's is not very Chutneyesk -- it should use the templating system.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/bootstrap-network.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh
new file mode 100755
index 0000000..cd18e3d
--- /dev/null
+++ b/tools/bootstrap-network.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+#
+# 1. potentially stop running network
+# 2. bootstrap a network from scratch as quickly as possible
+# 3. tail -F all the tor log files
+#
+# NOTE: leaves debris around by renaming directory net/nodes
+# and creating a new net/nodes
+#
+# Usage:
+# cd YOUR-CHUTNEY-DIRECTORY
+# tools/bootstrap-network.sh [network-flavour]
+# network-flavour: one of the files in the networks directory,
+# (default: 'basic')
+#
+
+VOTING_OFFSET=6
+CHUTNEY=./chutney
+
+[ -x $CHUTNEY ] || { echo "$0: missing $CHUTNEY"; exit 1; }
+[ -d networks ] || { echo "$0: missing directory: networks"; exit 1; }
+[ -d net ] || { echo "$0: missing directory: net"; exit 1; }
+flavour=basic; [ -n "$1" ] && { flavour=$1; shift; }
+
+$CHUTNEY stop networks/$flavour
+[ -d net/nodes ] && mv net/nodes net/nodes.$(date +%s)
+echo "$0: boostrapping network: $flavour"
+$CHUTNEY configure networks/$flavour
+
+# TODO: Make 'chutney configure' take an optional offset argument and
+# use the templating system in Chutney to set this instead of editing
+# files like this.
+offset=$(expr \( $(date +%s) + $VOTING_OFFSET \) % 300)
+CONFOPT="TestingV3AuthVotingStartOffset"
+for file in net/nodes/*a/torrc; do
+ sed -i.bak -e "s/^${CONFOPT}.*$/${CONFOPT} $offset/1" $file
+done
+
+$CHUTNEY start networks/$flavour
+tail -F net/nodes/*/notice.log