2015-04-30 23:03:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ! -e ../mktopology ]; then
|
|
|
|
echo 'Build ../mktopology first!'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-05-06 10:05:20 +00:00
|
|
|
echo 'Populating rootservers/* with all Docker test-rootserver-* container IPs and identities...'
|
2015-04-30 23:03:44 +00:00
|
|
|
|
2015-05-06 10:05:20 +00:00
|
|
|
rm -rf rootservers
|
|
|
|
mkdir rootservers
|
2015-04-30 23:03:44 +00:00
|
|
|
|
2015-05-06 10:05:20 +00:00
|
|
|
for cid in `docker ps -f 'name=test-rootserver-*' -q`; do
|
2015-04-30 23:13:17 +00:00
|
|
|
id=`docker exec $cid cat /var/lib/zerotier-one/identity.secret | cut -d : -f 1-3`
|
2015-04-30 23:03:44 +00:00
|
|
|
ztaddr=`echo $id | cut -d : -f 1`
|
|
|
|
ip=`docker exec $cid ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
|
|
|
|
echo $cid $ztaddr $id $ip
|
2015-05-06 10:05:20 +00:00
|
|
|
echo "id=$id" >rootservers/$ztaddr
|
|
|
|
echo "udp=$ip/9993" >>rootservers/$ztaddr
|
2015-04-30 23:03:44 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
echo 'Creating test-root-topology...'
|
|
|
|
|
|
|
|
rm -f test-root-topology
|
|
|
|
../mktopology >test-root-topology
|
|
|
|
|
|
|
|
echo 'Done!'
|
|
|
|
echo
|
|
|
|
cat test-root-topology
|
|
|
|
|
|
|
|
exit 0
|