From 946d092886d02a70acf8c671297d396015fbbe63 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 7 Feb 2018 18:20:23 +0100 Subject: Makefile: check_rootpw function & calls --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Makefile') 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) \ -- cgit v1.2.3-55-g7522