summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile21
1 files changed, 14 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d8cef19..03d6cd8 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,7 @@ FLAVORS := $(patsubst $(ANSIBLE_DIR_PROV)/setup-%.yml,%, $(wildcard $(ANSIBLE_DI
BASETARGETS := $(foreach template, $(TEMPLATES), $(template)/base)
PROVTARGETS := $(foreach template, $(TEMPLATES), $(foreach flavor, $(FLAVORS), $(template)/$(flavor)))
+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)
@@ -121,7 +122,7 @@ ifdef VERBOSE
endif
-.PHONY: help clean_except_last clean_bases clean_all clean_failed
+.PHONY: help clean_except_last clean_bases clean_all clean_failed $(REPROVTARGETS)
help:
@@ -144,22 +145,27 @@ $(BASETARGETS):
# Provisioning images
-$(PROVTARGETS):
-$(foreach flav, $(FLAVORS), %/$(flav)): %/base
+$(PROVTARGETS): $(foreach flav, $(FLAVORS), %/$(flav)): %/base
+
+$(PROVTARGETS) $(REPROVTARGETS):
+ $(eval FLAVOR := $(basename $(@F)))
+ $(eval VERSION := $(if $(suffix $(@)), $(subst .,,$(suffix $(@))), 0))
$(eval BASE_IMAGE := $(if $(wildcard $(@D)/build/rootfs-image),\
$(@)/build/rootfs-image,\
$(@D)/base/rootfs-image))
- $(eval BUILD_DIR := $(@D)/$(@F).$(TIMESTAMP))
- $(info ** Provisioning '$(@D)' with '$(@F)' **)
+ $(eval BUILD_DIR := $(@D)/$(FLAVOR).$(TIMESTAMP))
+ $(info ** Provisioning '$(@D)' with '$(FLAVOR)' **)
@mkdir -p $(BUILD_DIR)
@cp -r `readlink -f $(ANSIBLE_DIR_PROV)` $(BUILD_DIR)/$(ANSIBLE_DIR_PROV)
- @ln -sfn $(@F).$(TIMESTAMP) $(@D)/$(@F).latest
+ @ln -sfn $(FLAVOR).$(TIMESTAMP) $(@D)/$(FLAVOR).latest
+ @-cp -r $@/$(ANSIBLE_DIR_PROV) $(BUILD_DIR)/$(ANSIBLE_DIR_PROV).$(VERSION)
+ @-cp -r $@/$(ANSIBLE_DIR_PROV).* $(BUILD_DIR)
$(PACKER) build -only=$(PROVISIONER) \
$(PACKER_OPTS) \
-var='vm_name=rootfs-image' \
-var='output_directory=$(BUILD_DIR)/build' \
-var='base_image=$(BASE_IMAGE)' \
- -var='playbook=$(BUILD_DIR)/$(ANSIBLE_DIR_PROV)/setup-$(@F).yml' \
+ -var='playbook=$(BUILD_DIR)/$(ANSIBLE_DIR_PROV)/setup-$(FLAVOR).yml' \
-var='extra_ansible_args=$(ANSIBLE_PROV_EXTRA_ARGS)' \
ansible-provisioner.json
@@ -241,6 +247,7 @@ help:
@echo
@echo "Provisioning images targets: "
@for P in $(PROVTARGETS); do printf "\t%s\n" "$$P"; done
+ @for P in $(REPROVTARGETS); do printf "\t%s\n" "$$P"; done
@echo
@echo "Generate boot files targets:"
@printf "\t<{base,provisioning}_target>/boot\n"