summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorManuel Messner2018-02-12 16:11:55 +0100
committerManuel Messner2018-02-12 16:11:55 +0100
commitec9e3027ed5f3505f2bc92452e79ed6a4909cb74 (patch)
tree4af61cdd97336f5938c034dbb12a5344275bcadb /Makefile
parentMakefile: add timestamp to verbose output (diff)
downloadpacker-templates-ec9e3027ed5f3505f2bc92452e79ed6a4909cb74.tar.gz
packer-templates-ec9e3027ed5f3505f2bc92452e79ed6a4909cb74.tar.xz
packer-templates-ec9e3027ed5f3505f2bc92452e79ed6a4909cb74.zip
Makefile: add spacing
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2146693..da435c4 100644
--- a/Makefile
+++ b/Makefile
@@ -5,20 +5,25 @@
PACKER = packer
ANSIBLE_DIR = ansible-roles
+
# check which hypervisors are available
ifndef BUILDER
ifeq ($(shell which qemu-system-$(shell uname -m | sed 's/i686/i386/') 2>&1 > /dev/null && echo $$?), 0)
AVAILABLE_BUILDERS += qemu
endif
+
ifeq ($(shell which virtualbox 2>&1 > /dev/null && echo $$?), 0)
AVAILABLE_BUILDERS += virtualbox-iso
endif
+
ifeq ($(shell which vmplayer 2>&1 > /dev/null && echo $$?), 0)
AVAILABLE_BUILDERS += vmware-iso
endif
+
BUILDER := $(firstword $(AVAILABLE_BUILDERS))
endif
+
##
# Templates and flavors detection
##
@@ -32,6 +37,7 @@ PROVTARGETS := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $
BOOTTARGETS := $(foreach template, $(TEMPLATES), $(template)/base/boot)
BOOTTARGETS += $(foreach prov, $(PROVTARGETS), $(prov)/boot)
+
PACKER_OPTS := -var-file=base.json
ifdef DEBUG
VERBOSE := 1
@@ -39,6 +45,7 @@ ifdef DEBUG
PACKER_OPTS += -var='headless=false'
endif
+
TIMESTAMP := $(shell date "+%Y-%m-%d_%H-%M-%S")
@@ -80,6 +87,7 @@ $(BASETARGETS):
-var='output_directory=$(@D)/base' \
$(@D).json
+
##
# Provisioning images
##
@@ -99,6 +107,7 @@ $(foreach flav, $(FLAVORS), %/$(flav)): %/base
-var='playbook=setup-$(@F).yml' \
$(BUILD_DIR)/$(ANSIBLE_DIR)/run-playbook-only.json
+
##
# Generating boot files
##
@@ -117,10 +126,12 @@ $(BOOTTARGETS):
$(BUILD_DIR)/$(ANSIBLE_DIR)/run-playbook-only.json
@mv $(BUILD_DIR)/$(ANSIBLE_DIR)/boot_files $(BUILD_DIR)/build/boot
+
# The builds are directories named after the template name
clean:
-$(foreach build_dir,$(TEMPLATES),test -d $(build_dir) && rm -rf $(build_dir);)
+
help:
@printf "Usage:\n\tmake <template>/<flavor>[/boot]\n"
@echo