summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJonathan Bauer2018-05-04 12:33:59 +0200
committerJonathan Bauer2018-05-04 12:33:59 +0200
commit12f559c4ef688898e538f4542396ee46b9582858 (patch)
tree60eeaf6cd7c860045095f563d53f897f218fa017 /Makefile
parentubuntu-18.04-amd64: switch to checksum url in virtualbox and vmplayer (diff)
downloadpacker-templates-12f559c4ef688898e538f4542396ee46b9582858.tar.gz
packer-templates-12f559c4ef688898e538f4542396ee46b9582858.tar.xz
packer-templates-12f559c4ef688898e538f4542396ee46b9582858.zip
Makefile: differentiate between ISO and provisioning builders
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files 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"