summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJonathan Bauer2018-02-07 18:20:23 +0100
committerJonathan Bauer2018-02-07 18:20:23 +0100
commit946d092886d02a70acf8c671297d396015fbbe63 (patch)
treef4638eb836f55b1be663c1c104417caf9c813b69 /Makefile
parentMakefile: cleaned up help a bit (diff)
downloadpacker-templates-946d092886d02a70acf8c671297d396015fbbe63.tar.gz
packer-templates-946d092886d02a70acf8c671297d396015fbbe63.tar.xz
packer-templates-946d092886d02a70acf8c671297d396015fbbe63.zip
Makefile: check_rootpw function & calls
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 9 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 2642cdd..ad98963 100644
--- a/Makefile
+++ b/Makefile
@@ -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) \