summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Abdo2019-10-25 10:58:35 +0200
committerThiago Abdo2019-10-25 10:58:35 +0200
commitb256d16a0fd523e2f949f4f59d17eac033181fd4 (patch)
tree1ae15d1abfc00ec42c3ec389d5496ba56ec298b0
parentMake possible to reapply ansible scritps generating a new build from a provis... (diff)
downloadpacker-templates-b256d16a0fd523e2f949f4f59d17eac033181fd4.tar.gz
packer-templates-b256d16a0fd523e2f949f4f59d17eac033181fd4.tar.xz
packer-templates-b256d16a0fd523e2f949f4f59d17eac033181fd4.zip
Make it possible to generate boot files from a specific image target
Signed-off-by: Thiago Abdo <tjabdo@inf.ufpr.br>
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 03d6cd8..86a5c97 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,7 @@ PROVTARGETS := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $
REPROVTARGETS := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $(filter-out $(template)/$(flavor).latest,$(wildcard $(template)/$(flavor).*))))
BOOTTARGETS := $(foreach template, $(TEMPLATES), $(template)/base/boot)
BOOTTARGETS += $(foreach prov, $(PROVTARGETS), $(prov)/boot)
+CURBOOTTARGETS := $(foreach prov, $(REPROVTARGETS), $(prov)/boot)
ifndef ANSIBLE_PROV_EXTRA_ARGS
ANSIBLE_PROV_EXTRA_ARGS :=
@@ -169,10 +170,10 @@ $(PROVTARGETS) $(REPROVTARGETS):
-var='extra_ansible_args=$(ANSIBLE_PROV_EXTRA_ARGS)' \
ansible-provisioner.json
-
# Generating boot files
-$(BOOTTARGETS):
-%/boot: %
+$(BOOTTARGETS): %/boot: %
+
+$(BOOTTARGETS) $(CURBOOTTARGETS):
$(eval BASE_DIR := $(if $(filter base,$(notdir $(@D))),\
,\
$(if $(wildcard $(@D)/build/.),\
@@ -181,6 +182,9 @@ $(BOOTTARGETS):
$(eval BUILD_DIR := $(if $(BASE_DIR),\
$(BASE_DIR)/build,\
$(@D)))
+ $(eval BUILD_DIR := $(if $(filter $(@), $(CURBOOTTARGETS)),\
+ $(BASE_DIR)/build,\
+ $(BUILD_DIR)))
$(eval ANSIBLE_DIR_CUR := $(if $(BASE_DIR),\
$(BASE_DIR)/$(ANSIBLE_DIR_PROV),\
$(ANSIBLE_DIR_PROV)))