Adam Ierymenko 9 years ago
parent
commit
0588589d57
1 changed files with 17 additions and 9 deletions
  1. 17 9
      linux-build-farm/build.sh

+ 17 - 9
linux-build-farm/build.sh

@@ -2,9 +2,9 @@
 
 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
+subdirs=$*
+if [ ! -n "$subdirs" ]; then
+	subdirs=`find . -type d -name '*-*' -printf '%f '`
 fi
 
 if [ ! -d ./ubuntu-trusty ]; then
@@ -20,10 +20,12 @@ cd linux-build-farm
 # 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.
 
-for distro in $*; do
-	cd $distro
+for distro in $subdirs; do
+	echo
+	echo "--- BUILDING FOR $distro ---"
+	echo
 
-	rm -f *.deb
+	cd $distro
 
 	cd x64
 	mv ../../zt1-src.tar.gz .
@@ -31,15 +33,21 @@ for distro in $*; do
 	mv zt1-src.tar.gz ../..
 	cd ..
 
-#	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'
-
 	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 debian ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
+	rm -f *.deb *.rpm
+
+	if [ -e "`echo $distro | grep -F debian`" -a -e "`echo $distro | grep -F ubuntu`" ]; 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'
+		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'
+	else
+		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'
+		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
 
 	cd ..
 done