diff options
-rw-r--r-- | Makefile | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -48,6 +48,12 @@ ifdef DEBUG PACKER_OPTS += -var='headless=false' endif +define check_rootpw + ifndef ROOTPW + $(error No root password is set, set it as ROOTPW in your environment.) + endif +endef + .PHONY: all help clean all: help @@ -55,9 +61,7 @@ all: help # Creating base images ## $(BASETARGETS): - ifndef ROOTPW - $(error ROOTPW is not set) - endif + $(call check_rootpw) $(info ** Building template '$(@D)' using '$(BUILDER)' **) $(PACKER) build -only=$(BUILDER) \ $(PACKER_OPTS) \ @@ -76,6 +80,7 @@ $(BASETARGETS): # This should still only use base images $(PROVTARGETS): $(foreach flav, $(FLAVORS), %/$(flav)): %/base + $(call check_rootpw) $(info ** Provisioning '$(@D)' with '$(@F)' **) $(PACKER) build -only=$(BUILDER) \ $(PACKER_OPTS) \ @@ -97,6 +102,7 @@ $(foreach flav, $(FLAVORS), %/$(flav)): %/base # This should use provisioned image $(BOOTTARGETS): %/boot: % + $(call check_rootpw) $(info ** Generating boot files for '$(patsubst %/,%,$(dir $(@D))):$(notdir $(@D))' **) $(PACKER) build -only=$(BUILDER) \ $(PACKER_OPTS) \ |