ZeroTierOne/linux-build-farm/build.sh

48 lines
1.3 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
if [ $# = 0 ]; then
echo 'Usage: ./build.sh <distribution-name> [<distribution-name>] ...'
exit 1
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-24 17:20:35 +00:00
for distro in $*; do
cd $distro
2016-06-24 21:45:09 +00:00
rm -f *.deb
2016-06-24 17:20:35 +00:00
cd x64
mv ../../zt1-src.tar.gz .
docker build -t zt1-build-${distro}-x64 .
mv zt1-src.tar.gz ../..
cd ..
# docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x64 /bin/bash -c 'cd /ZeroTierOne ; make `[ -f /etc/debian_version ] && echo debian || echo redhat` ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
2016-06-24 17:20:35 +00:00
cd x86
mv ../../zt1-src.tar.gz .
docker build -t zt1-build-${distro}-x86 .
mv zt1-src.tar.gz ../..
cd ..
# docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x86 /bin/bash -c 'cd /ZeroTierOne ; make `[ -f /etc/debian_version ] && echo debian || echo redhat` ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
2016-06-24 17:20:35 +00:00
cd ..
done
rm -f zt1-src.tar.gz