2015-09-28 20:56:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-09-29 00:07:46 +00:00
|
|
|
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/
|
2015-09-28 22:31:47 +00:00
|
|
|
|
|
|
|
echo '***'
|
|
|
|
echo '*** ZeroTier Network Containers Preview'
|
|
|
|
echo '*** https://www.zerotier.com/'
|
|
|
|
echo '***'
|
|
|
|
echo '*** Starting ZeroTier network container host...'
|
|
|
|
|
2015-09-28 23:14:32 +00:00
|
|
|
chown -R daemon /var/lib/zerotier-one
|
|
|
|
chgrp -R daemon /var/lib/zerotier-one
|
|
|
|
su daemon -s /bin/bash -c '/zerotier-one -d -U -p9993 >>/tmp/zerotier-one.out 2>&1'
|
2015-09-29 05:14:32 +00:00
|
|
|
#/zerotier-one -d -U -p9993 >>/tmp/zerotier-one.out 2>&1
|
2015-09-28 22:31:47 +00:00
|
|
|
|
|
|
|
echo '*** Waiting for initial identity generation...'
|
|
|
|
|
|
|
|
while [ ! -s /var/lib/zerotier-one/identity.secret ]; do
|
2015-09-29 00:07:46 +00:00
|
|
|
sleep 0.2
|
2015-09-28 22:31:47 +00:00
|
|
|
done
|
|
|
|
|
2015-09-29 00:07:46 +00:00
|
|
|
# HACK: permissions model nonexistent yet... make sure httpd's can talk to this...
|
|
|
|
chmod 0777 /tmp/.zt*
|
2015-09-28 22:31:47 +00:00
|
|
|
|
2015-09-29 00:07:46 +00:00
|
|
|
echo '*** Waiting for network config...'
|
2015-09-28 22:31:47 +00:00
|
|
|
|
|
|
|
virtip4=""
|
2015-09-28 23:14:32 +00:00
|
|
|
while [ ! -s /var/lib/zerotier-one/networks.d/8056c2e21c000001.conf ]; do
|
2015-09-29 00:07:46 +00:00
|
|
|
sleep 0.2
|
2015-09-28 22:31:47 +00:00
|
|
|
done
|
|
|
|
while [ -z "$virtip4" ]; do
|
2015-09-29 00:07:46 +00:00
|
|
|
sleep 0.2
|
2015-09-28 23:14:32 +00:00
|
|
|
virtip4=`/zerotier-cli listnetworks | grep -F 8056c2e21c000001 | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
2015-09-28 22:31:47 +00:00
|
|
|
done
|
|
|
|
|
2015-09-28 23:14:32 +00:00
|
|
|
echo '*** Starting Apache...'
|
|
|
|
|
2015-09-28 22:31:47 +00:00
|
|
|
echo '***'
|
2015-09-28 23:14:32 +00:00
|
|
|
echo '*** Up and running at' $virtip4 '-- join network 8056c2e21c000001 and try:'
|
|
|
|
echo '*** > ping' $virtip4
|
2015-09-28 22:31:47 +00:00
|
|
|
echo -n '*** > curl http://'
|
|
|
|
echo -n $virtip4
|
|
|
|
echo '/'
|
|
|
|
echo '***'
|
2015-09-29 00:07:46 +00:00
|
|
|
echo "*** Be (a little) patient. It'll probably take 1-2 minutes to be reachable."
|
2015-09-28 23:14:32 +00:00
|
|
|
echo '***'
|
|
|
|
echo '*** Follow https://www.zerotier.com/blog for news and release announcements!'
|
|
|
|
echo '***'
|
2015-09-28 21:30:18 +00:00
|
|
|
|
2015-09-29 05:14:32 +00:00
|
|
|
#while /bin/true; do
|
|
|
|
# sleep 1000000
|
|
|
|
#done
|
|
|
|
|
|
|
|
sleep 0.5
|
|
|
|
rm -rf /run/httpd/* /tmp/httpd*
|
|
|
|
intercept /usr/sbin/httpd -D FOREGROUND >>/tmp/apache.out 2>&1
|