summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJonathan Bauer2018-02-12 19:30:50 +0100
committerJonathan Bauer2018-02-12 19:30:50 +0100
commit8ce1f11851a42777fb908925d7b9ddc9e16aac8a (patch)
treea56f8594a81957bf46a8d55931564768cd2d8680 /Makefile
parentMakefile: move headless option to verbose (diff)
downloadpacker-templates-8ce1f11851a42777fb908925d7b9ddc9e16aac8a.tar.gz
packer-templates-8ce1f11851a42777fb908925d7b9ddc9e16aac8a.tar.xz
packer-templates-8ce1f11851a42777fb908925d7b9ddc9e16aac8a.zip
Makefile: check_rootpw: add support for password hash check
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 5ef908d..4c16a67 100644
--- a/Makefile
+++ b/Makefile
@@ -70,10 +70,12 @@ ifdef VERBOSE
$(info )
endif
-
+HASHER := sha256sum
check_rootpw = $(if $(strip $(ROOTPW)),\
$(if $1,\
- ,\
+ $(if $(shell echo $(ROOTPW) | $(HASHER) --check --quiet $1/base/rootpw.$(HASHER)),\
+ $(error ROOTPW password hash does not match $1/base/rootpw.$(HASHER)),\
+ ),\
),\
$(error No root password is set, set it as ROOTPW in your environment.) \
)
@@ -92,6 +94,7 @@ $(BASETARGETS):
-var='vm_name=rootfs-image' \
-var='output_directory=$(@D)/base' \
$(@D).json
+ @echo $(ROOTPW) | $(HASHER) > $(@D)/base/rootpw.$(HASHER)
# Provisioning images