diff options
author | Manuel Messner | 2018-02-19 10:36:14 +0100 |
---|---|---|
committer | Manuel Messner | 2018-02-19 13:07:34 +0100 |
commit | 20a247f8ea2b0c6cab8bbb00b065fed8f9d5644e (patch) | |
tree | dc8630cae1ab129660e210564b9e525ad38da5a3 | |
parent | Makefile: help: extend and reformat (diff) | |
download | packer-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.
-rw-r--r-- | Makefile | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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 |