2015-10-09 17:14:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
|
|
|
|
|
|
|
|
if [ ! -c "/dev/net/tun" ]; then
|
|
|
|
echo 'FATAL: must be docker run with: --device=/dev/net/tun --cap-add=NET_ADMIN'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$ZEROTIER_IDENTITY_SECRET" ]; then
|
|
|
|
echo 'FATAL: ZEROTIER_IDENTITY_SECRET not set -- aborting!'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$ZEROTIER_NETWORK" ]; then
|
|
|
|
echo 'Warning: ZEROTIER_NETWORK not set, you will need to docker exec zerotier-cli to join a network.'
|
|
|
|
else
|
|
|
|
# The existence of a .conf will cause the service to "remember" this network
|
|
|
|
touch /var/lib/zerotier-one/networks.d/$ZEROTIER_NETWORK.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f /var/lib/zerotier-one/identity.*
|
2015-10-09 21:51:38 +00:00
|
|
|
echo "$ZEROTIER_IDENTITY_SECRET" >/var/lib/zerotier-one/identity.secret
|
2015-10-09 17:14:20 +00:00
|
|
|
|
|
|
|
/var/lib/zerotier-one/zerotier-one
|