Add file hashing for static files
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com> Upstream-commit: a1b7f6f3407546ff41ed2e0d16d7e1b2a8ac0ef4 Component: packaging
This commit is contained in:
@ -4,6 +4,7 @@ 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
|
||||
|
||||
.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine
|
||||
|
||||
@ -23,11 +24,13 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
|
||||
cp $(ENGINE_DIR)/bundles/$(ENGINE_VER)/binary-daemon/$$f build/linux/docker; \
|
||||
done
|
||||
tar -C build/linux -c -z -f build/linux/docker-$(VERSION).tgz docker
|
||||
$(HASH_CMD) build/linux
|
||||
|
||||
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
|
||||
tar -C build/mac -c -z -f build/mac/docker-$(VERSION).tgz docker
|
||||
$(HASH_CMD) build/mac
|
||||
|
||||
cross-win: cross-all-cli cross-win-engine ## create zip file with windows x86_64 client and server
|
||||
mkdir -p build/win/docker
|
||||
@ -35,11 +38,13 @@ cross-win: cross-all-cli cross-win-engine ## create zip file with windows x86_64
|
||||
cp $(ENGINE_DIR)/bundles/$(ENGINE_VER)/cross/windows/amd64/dockerd-$(ENGINE_VER).exe build/win/docker/dockerd.exe
|
||||
docker run --rm -v $(CURDIR)/build/win:/v -w /v alpine sh -c 'apk update&&apk add zip&&zip -r docker-$(VERSION).zip docker'
|
||||
$(CHOWN) -R $(shell id -u):$(shell id -g) build
|
||||
$(HASH_CMD) bash hash_files build/win
|
||||
|
||||
cross-arm: cross-all-cli ## create tgz with linux armhf client only
|
||||
mkdir -p build/arm/docker
|
||||
cp $(CLI_DIR)/build/docker-linux-arm build/arm/docker/docker
|
||||
tar -C build/arm -c -z -f build/arm/docker-$(VERSION).tgz docker
|
||||
$(HASH_CMD) build/arm
|
||||
|
||||
static-cli:
|
||||
$(MAKE) -C $(CLI_DIR) -f docker.Makefile VERSION=$(VERSION) build
|
||||
|
||||
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