diff --git a/.gitignore b/.gitignore index 929180b40..f44bae33e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ test.log +/bin *.swp -/hyperkit.bin *.img *.tag *.iso diff --git a/Makefile b/Makefile index 5b01df732..9a7249cd8 100644 --- a/Makefile +++ b/Makefile @@ -31,27 +31,28 @@ qemu-iso: alpine/mobylinux-bios.iso qemu-gce: alpine/gce.img.tar.gz docker run -it --rm -v $(CURDIR)/alpine/gce.img.tar.gz:/tmp/gce.img.tar.gz $(QEMU_IMAGE) -hyperkit.bin: - mkdir $@ +bin: + mkdir -p $@ -hyperkit.bin/com.docker.hyperkit: hyperkit.bin +bin/com.docker.hyperkit: bin curl -fsSL https://circleci.com/api/v1/project/docker/hyperkit/latest/artifacts/0//Users/distiller/hyperkit/build/com.docker.hyperkit > $@ chmod a+x $@ -hyperkit.bin/com.docker.slirp: +bin/com.docker.slirp: bin curl -fsSL https://circleci.com/api/v1/project/docker/vpnkit/latest/artifacts/0//Users/distiller/vpnkit/com.docker.slirp.tgz \ - | tar xz --strip=2 -C hyperkit.bin Contents/MacOS/com.docker.slirp + | tar xz --strip=2 -C $(dir $@) Contents/MacOS/com.docker.slirp + touch $@ -hyperkit: hyperkit.sh hyperkit.bin/com.docker.hyperkit hyperkit.bin/com.docker.slirp alpine/initrd.img alpine/kernel/x86_64/vmlinuz64 +hyperkit: hyperkit.sh bin/com.docker.hyperkit bin/com.docker.slirp alpine/initrd.img alpine/kernel/x86_64/vmlinuz64 ./hyperkit.sh define check_test_log @cat $1 |grep -q 'Moby test suite PASSED' endef -hyperkit-test: hyperkit.sh hyperkit.bin/com.docker.hyperkit hyperkit.bin/com.docker.slirp alpine/initrd-test.img alpine/kernel/x86_64/vmlinuz64 +hyperkit-test: hyperkit.sh bin/com.docker.hyperkit bin/com.docker.slirp alpine/initrd-test.img alpine/kernel/x86_64/vmlinuz64 rm -f disk.img - INITRD=alpine/initrd-test.img ./hyperkit.sh 2>&1 | tee test.log + INITRD=alpine/initrd-test.img script -q /dev/null ./hyperkit.sh | tee test.log $(call check_test_log, test.log) test: alpine/initrd-test.img alpine/kernel/x86_64/vmlinuz64 @@ -125,4 +126,4 @@ ci-pr: clean: $(MAKE) -C alpine clean - rm -rf hyperkit.bin disk.img test.log + rm -rf bin disk.img test.log diff --git a/hyperkit.sh b/hyperkit.sh index 0b8c1c300..fdabaafee 100755 --- a/hyperkit.sh +++ b/hyperkit.sh @@ -17,7 +17,7 @@ PCI_DEV="-s 0:0,hostbridge -s 31,lpc" RND="-s 5,virtio-rnd" LPC_DEV="-l com1,stdio" -hyperkit.bin/com.docker.slirp --ethernet $SLIRP_SOCK &>/dev/null & +bin/com.docker.slirp --ethernet $SLIRP_SOCK &>/dev/null & trap "kill $!; rm $SLIRP_SOCK" EXIT -hyperkit.bin/com.docker.hyperkit -A $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_HDD $RND -u -f kexec,$KERNEL,$INITRD,"$CMDLINE" +bin/com.docker.hyperkit -A $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_HDD $RND -u -f kexec,$KERNEL,$INITRD,"$CMDLINE"