bootstrap-network.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #! /bin/sh
  2. #
  3. # 1. potentially stop running network
  4. # 2. bootstrap a network from scratch as quickly as possible
  5. # 3. tail -F all the tor log files
  6. #
  7. # NOTE: leaves debris around by renaming directory net/nodes
  8. # and creating a new net/nodes
  9. #
  10. # Usage:
  11. # cd YOUR-CHUTNEY-DIRECTORY
  12. # tools/bootstrap-network.sh [network-flavour]
  13. # network-flavour: one of the files in the networks directory,
  14. # (default: 'basic')
  15. #
  16. VOTING_OFFSET=6
  17. CHUTNEY=./chutney
  18. myname=$(basename "$0")
  19. [ -x $CHUTNEY ] || { echo "$myname: missing $CHUTNEY"; exit 1; }
  20. [ -d networks ] || { echo "$myname: missing directory: networks"; exit 1; }
  21. flavour=basic; [ -n "$1" ] && { flavour=$1; shift; }
  22. $CHUTNEY stop networks/$flavour
  23. echo "$myname: boostrapping network: $flavour"
  24. $CHUTNEY configure networks/$flavour
  25. # TODO: Make 'chutney configure' take an optional offset argument and
  26. # use the templating system in Chutney to set this instead of editing
  27. # files like this.
  28. offset=$(expr \( $(date +%s) + $VOTING_OFFSET \) % 300)
  29. CONFOPT="TestingV3AuthVotingStartOffset"
  30. for file in net/nodes/*a/torrc; do
  31. sed -i.bak -e "s/^${CONFOPT}.*$/${CONFOPT} $offset/1" $file
  32. done
  33. $CHUTNEY start networks/$flavour
  34. $CHUTNEY status networks/$flavour
  35. #echo "tail -F net/nodes/*/notice.log"