create-test-root-topology.sh 769 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. if [ ! -e ../mktopology ]; then
  3. echo 'Build ../mktopology first!'
  4. exit 1
  5. fi
  6. echo 'Populating rootservers/* with all Docker test-rootserver-* container IPs and identities...'
  7. rm -rf rootservers
  8. mkdir rootservers
  9. for cid in `docker ps -f 'name=test-rootserver-*' -q`; do
  10. id=`docker exec $cid cat /var/lib/zerotier-one/identity.secret | cut -d : -f 1-3`
  11. ztaddr=`echo $id | cut -d : -f 1`
  12. ip=`docker exec $cid ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
  13. echo $cid $ztaddr $id $ip
  14. echo "id=$id" >rootservers/$ztaddr
  15. echo "udp=$ip/9993" >>rootservers/$ztaddr
  16. done
  17. echo 'Creating test-root-topology...'
  18. rm -f test-root-topology
  19. ../mktopology >test-root-topology
  20. echo 'Done!'
  21. echo
  22. cat test-root-topology
  23. exit 0