From 12f559c4ef688898e538f4542396ee46b9582858 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 4 May 2018 12:33:59 +0200 Subject: Makefile: differentiate between ISO and provisioning builders --- Makefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 22ebb51..d1f8426 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,15 @@ ARCH := $(shell uname -m | sed 's/i686/i386/') BUILDER_QEMU_EXE := qemu-system-$(ARCH) BUILDER_QEMU_NAME := qemu +BUILDER_QEMU_PROV := $(BUILDER_QEMU_NAME) BUILDER_VMWARE_EXE := vmware BUILDER_VMWARE_NAME := vmware-iso +BUILDER_VMWARE_PROV := vmware-vmx BUILDER_VIRTUALBOX_EXE := virtualbox BUILDER_VIRTUALBOX_NAME := virtualbox-iso +BUILDER_VIRTUALBOX_PROV := virtualbox-ovf BUILDERS := QEMU VMWARE VIRTUALBOX @@ -29,6 +32,12 @@ ifndef BUILDER BUILDER := $(firstword $(AVAILABLE_BUILDERS)) endif +ifndef PROVISIONER + $(foreach cur, $(BUILDERS),\ + $(if $(filter $(BUILDER),$(BUILDER_$(cur)_NAME)),\ + $(eval PROVISIONER := $(BUILDER_$(cur)_PROV)))) +endif + # The packer templates, detected as *.json (excluding base.json) TEMPLATES := $(basename $(filter-out base.json,$(wildcard *.json))) @@ -126,7 +135,7 @@ $(foreach flav, $(FLAVORS), %/$(flav)): %/base @mkdir -p $(BUILD_DIR) @cp -r $(ANSIBLE_DIR) $(BUILD_DIR)/$(ANSIBLE_DIR) @ln -sfn $(@F).$(TIMESTAMP) $(@D)/$(@F).latest - $(PACKER) build -only=$(BUILDER) \ + $(PACKER) build -only=$(PROVISIONER) \ $(PACKER_OPTS) \ -var='vm_name=rootfs-image' \ -var='output_directory=$(BUILD_DIR)/build' \ @@ -145,7 +154,7 @@ $(BOOTTARGETS): $(ANSIBLE_DIR),\ $(@D).$(TIMESTAMP)/$(ANSIBLE_DIR))) $(info ** Generating boot files for '$(BUILD_DIR)') - $(PACKER) build -only=$(BUILDER) \ + $(PACKER) build -only=$(PROVISIONER) \ $(PACKER_OPTS) \ -var='vm_name=rootfs-image.tmp' \ -var='output_directory=$(BUILD_DIR)/tmp' \ @@ -210,7 +219,8 @@ help: @echo @echo "Available options are:" @printf "\tANSIBLE_DIR: Set directory with ansible roles (def: ansible-roles)\n" - @printf "\tBUILDER: Set a builder, do not autodetect\n" + @printf "\tBUILDER: Set an ISO builder, do not autodetect\n" + @printf "\tPROVISIONER: Set a provisioning builder, do not autodetect\n" @printf "\tDEBUG: Enable debug mode in packer (includes VERBOSE)\n" @printf "\t DEBUG= Enable enhanced on-error handling\n" @printf "\t DEBUG=STEP Enable step by step debugging in packer\n" -- cgit v1.2.3-55-g7522