ZeroTierOne/linux-build-farm/build.sh

70 lines
2.0 KiB
Bash
Raw Normal View History

2016-06-24 17:20:35 +00:00
#!/bin/bash
export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
2016-06-27 23:21:55 +00:00
subdirs=$*
if [ ! -n "$subdirs" ]; then
subdirs=`find . -type d -name '*-*' -printf '%f '`
2016-06-24 17:20:35 +00:00
fi
if [ ! -d ./ubuntu-trusty ]; then
echo 'Must run from linux-build-farm subfolder.'
exit 1
fi
rm -f zt1-src.tar.gz
cd ..
git archive --format=tar.gz --prefix=ZeroTierOne/ -o linux-build-farm/zt1-src.tar.gz HEAD
cd linux-build-farm
2016-06-24 21:57:20 +00:00
# Note that --privileged is used so we can bind mount VM shares when building in a VM.
# It has no other impact or purpose, but probably doesn't matter here in any case.
2016-06-27 23:21:55 +00:00
for distro in $subdirs; do
echo
echo "--- BUILDING FOR $distro ---"
echo
2016-06-24 17:20:35 +00:00
2016-06-27 23:21:55 +00:00
cd $distro
2016-06-24 21:45:09 +00:00
2016-06-29 21:35:53 +00:00
if [ -d x64 ]; then
cd x64
mv ../../zt1-src.tar.gz .
docker build -t zt1-build-${distro}-x64 .
mv zt1-src.tar.gz ../..
cd ..
fi
2016-06-24 17:20:35 +00:00
2016-06-29 21:35:53 +00:00
if [ -d x86 ]; then
cd x86
mv ../../zt1-src.tar.gz .
docker build -t zt1-build-${distro}-x86 .
mv zt1-src.tar.gz ../..
cd ..
fi
2016-06-24 17:20:35 +00:00
2016-06-27 23:21:55 +00:00
rm -f *.deb *.rpm
2016-07-07 00:59:08 +00:00
exit 0
2016-06-28 23:09:36 +00:00
2016-06-27 23:38:08 +00:00
if [ ! -n "`echo $distro | grep -F debian`" -a ! -n "`echo $distro | grep -F ubuntu`" ]; then
2016-06-29 21:35:53 +00:00
if [ -d x64 ]; then
docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x64 /bin/bash -c 'cd /ZeroTierOne ; make redhat ; cd .. ; cp `find /root/rpmbuild -type f -name *.rpm` /artifacts ; ls -l /artifacts'
fi
if [ -d x86 ]; then
docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x86 /bin/bash -c 'cd /ZeroTierOne ; make redhat ; cd .. ; cp `find /root/rpmbuild -type f -name *.rpm` /artifacts ; ls -l /artifacts'
fi
2016-06-27 23:21:55 +00:00
else
2016-06-29 21:35:53 +00:00
if [ -d x64 ]; then
docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x64 /bin/bash -c 'cd /ZeroTierOne ; make debian ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
fi
if [ -d x86 ]; then
docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x86 /bin/bash -c 'cd /ZeroTierOne ; make debian ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
fi
2016-06-27 23:21:55 +00:00
fi
2016-06-24 17:20:35 +00:00
cd ..
done
rm -f zt1-src.tar.gz