Merge pull request #1 from seemethere/add_file_hashing
Add file hashing for static files Upstream-commit: 48d4119a0bdb61639214a971360490e8a4fbe025 Component: packaging
This commit is contained in:
@ -4,8 +4,10 @@ CLI_DIR:=$(CURDIR)/../../cli
|
||||
ENGINE_VER=$(shell cat $(ENGINE_DIR)/VERSION)
|
||||
VERSION=$(shell cat $(ENGINE_DIR)/VERSION)
|
||||
CHOWN=docker run --rm -v $(CURDIR):/v -w /v alpine chown
|
||||
HASH_CMD=docker run -v $(CURDIR):/sum -it -w /sum debian:jessie bash hash_files
|
||||
DIR_TO_HASH:=build/linux
|
||||
|
||||
.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine
|
||||
.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine hash_files
|
||||
|
||||
help: ## show make targets
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||
@ -24,6 +26,10 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
|
||||
done
|
||||
tar -C build/linux -c -z -f build/linux/docker-$(VERSION).tgz docker
|
||||
|
||||
hash_files:
|
||||
@echo "Hashing directory $(DIR_TO_HASH)"
|
||||
$(HASH_CMD) "$(DIR_TO_HASH)"
|
||||
|
||||
cross-mac: cross-all-cli ## create tgz with darwin x86_64 client only
|
||||
mkdir -p build/mac/docker
|
||||
cp $(CLI_DIR)/build/docker-darwin-amd64 build/mac/docker/docker
|
||||
|
||||
11
components/packaging/static/hash_files
Normal file
11
components/packaging/static/hash_files
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Simple script to hash all the files in a given directory
|
||||
|
||||
DIR_TO_LOOK_IN=${1:-build/linux}
|
||||
|
||||
for f in $(find "$DIR_TO_LOOK_IN" -type f); do
|
||||
for hash_algo in md5 sha256; do
|
||||
"${hash_algo}sum" "$f" > "$f.$hash_algo"
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user