Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Add file hashing for static files
Browse files Browse the repository at this point in the history
Signed-off-by: Eli Uriegas <[email protected]>
(cherry picked from commit a1b7f6f)

Conflicts:
components/packaging/static/Makefile
Signed-off-by: Andrew Hsu <[email protected]>
  • Loading branch information
seemethere authored and andrewhsu committed Jun 6, 2017
1 parent 1835507 commit 7239874
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/packaging/static/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ 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

hash_files:
@echo "Hashing directory $(DIR_TO_HASH)"
Expand All @@ -34,18 +35,21 @@ 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
cp $(CLI_DIR)/build/docker-windows-amd64 build/win/docker/docker.exe
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
Expand Down
11 changes: 11 additions & 0 deletions components/packaging/static/hash_files
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7239874

Please sign in to comment.