Browse Source

Maybe we ran out of disk space because we ran out of disk space.

Rob Austein 6 years ago
parent
commit
d3c3b4548f
2 changed files with 12 additions and 9 deletions
  1. 6 5
      Builder
  2. 6 4
      Makefile

+ 6 - 5
Builder

@@ -9,6 +9,8 @@ ls -ld "${XILINX_PKGDIR}"
 
 RAT_PACKAGES='libglib2.0-0 libxrandr2 python-xvfbwrapper ratpoison sudo'
 
+BUILDER_LICENSE="/home/builder/${XILINX_LICENSE}"
+
 apt-get update
 
 apt-get install -y ${RAT_PACKAGES}
@@ -17,9 +19,7 @@ adduser --disabled-password --gecos 'Cryptech Build Bot' --shell /bin/sh builder
 
 echo >/etc/sudoers.d/builder 'builder ALL = (ALL) NOPASSWD: SETENV: ALL'
 
-install -o builder -g builder \
-	"/cryptech-builder/${XILINX_LICENSE}" \
-	"/home/builder/${XILINX_LICENSE}"
+install -o builder -g builder "/cryptech-builder/${XILINX_LICENSE}" "${BUILDER_LICENSE}"
 
 ln -sf /bin/bash /bin/sh
 
@@ -27,6 +27,7 @@ ln -sf /bin/bash /bin/sh
 
 chown -R builder:builder /home/builder
 
-rm -rf "${XILINX_PKGDIR}" "/home/builder/${XILINX_LICENSE}"
+rm -f "${BUILDER_LICENSE}"
 
-apt-get remove -y --purge --autoremove ${RAT_PACKAGES}
+apt-get purge -y ${RAT_PACKAGES}
+apt-get autoremove -y --purge

+ 6 - 4
Makefile

@@ -3,7 +3,7 @@ XILINX_LICENSE		:= Xilinx.lic
 BOOTSTRAP_IMAGE		:= cryptech-builder:bootstrap
 BOOTSTRAP_CONTAINER	:= cryptech-builder-bootstrap
 CRYPTECH_BASE_FILE	:= cryptech-builder-base-image.xz
-XILINX_PKGDIR		:= $(basename ${XILINX_TARBALL})
+XILINX_PKGDIR		:= fs/$(basename ${XILINX_TARBALL})
 
 ifneq (./,$(sort $(dir ${XILINX_TARBALL} ${XILINX_LICENSE})))
 $(error XILINX_TARBALL and XILINX_LICENSE must be in this directory for bind mount)
@@ -19,16 +19,18 @@ ${CRYPTECH_BASE_FILE}: ${XILINX_TARBALL} ${XILINX_LICENSE} Builder Ratinox
 	rm -rf fs
 	mkdir fs
 	sudo /usr/sbin/debootstrap --foreign jessie fs
-	sudo tar -C fs -xf ${XILINX_TARBALL}
-	test -d fs/${XILINX_PKGDIR}
 	sudo tar -C fs -c . | docker import - ${BOOTSTRAP_IMAGE}
 	sudo rm -rf fs
+	mkdir fs
+	tar -C fs -xf ${XILINX_TARBALL}
+	test -d ${XILINX_PKGDIR}
 	docker run -it --name ${BOOTSTRAP_CONTAINER} \
 		--mount type=bind,source=$(abspath .),target=/cryptech-builder \
-		--env 'XILINX_PKGDIR=/${XILINX_PKGDIR}' \
+		--env 'XILINX_PKGDIR=/cryptech-builder/${XILINX_PKGDIR}' \
 		--env 'XILINX_LICENSE=${XILINX_LICENSE}' \
 		${BOOTSTRAP_IMAGE} \
 		/cryptech-builder/Builder
+	rm -rf fs
 	-mogrify -verbose -format png *.xwd && rm *.xwd
 	docker export ${BOOTSTRAP_CONTAINER} | xz -v >${CRYPTECH_BASE_FILE}.tmp
 	docker container rm -f ${BOOTSTRAP_CONTAINER}