summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorManuel Messner2018-02-19 10:36:14 +0100
committerManuel Messner2018-02-19 13:07:34 +0100
commit20a247f8ea2b0c6cab8bbb00b065fed8f9d5644e (patch)
treedc8630cae1ab129660e210564b9e525ad38da5a3 /Makefile
parentMakefile: help: extend and reformat (diff)
downloadpacker-templates-20a247f8ea2b0c6cab8bbb00b065fed8f9d5644e.tar.gz
packer-templates-20a247f8ea2b0c6cab8bbb00b065fed8f9d5644e.tar.xz
packer-templates-20a247f8ea2b0c6cab8bbb00b065fed8f9d5644e.zip
Makefile: fix ROOTPW check
For the base target, the password must only be checked for existance; not for correctness, too. The comparison file does not exist yet. We cannot simply do a $(filter /base,$(PW_NEEDED)) because the base target might be included implicitely. What we do instead is, we check for the existance of the base directory and only if it exists, we do the comparison.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 9ea75dd..a492b9a 100644
--- a/Makefile
+++ b/Makefile
@@ -64,9 +64,11 @@ ifneq ($(PW_NEEDED),)
$(error No root password is set, set it as ROOTPW in your environment.)
else
$(foreach cur,$(PW_NEEDED),\
- $(shell printf "$(ROOTPW)" | $(HASHER) --check --status "$(firstword $(subst /, ,$(cur)))/base/rootpw.$(HASHER)")\
- $(if $(filter 1,$(.SHELLSTATUS)),\
- $(error The wrong ROOTPW is set. Please correct it)))
+ $(eval cur_dir := $(firstword $(subst /, ,$(cur)))/base)\
+ $(if $(shell test -d "$(cur_dir)" && echo yes),\
+ $(shell echo "$(ROOTPW)" | $(HASHER) --check --status "$(cur_dir)/rootpw.$(HASHER)")\
+ $(if $(filter 1,$(.SHELLSTATUS)),\
+ $(error The wrong ROOTPW is set. Please correct it))))
endif
endif