#!/bin/bash CROSS="$DEST/../cross" set -e if [ ! -d "$CROSS/linux/amd64" ]; then echo >&2 'error: binary and cross must be run before tgz' false fi ( for d in "$CROSS/"*/*; do export GOARCH="$(basename "$d")" export GOOS="$(basename "$(dirname "$d")")" BINARY_NAME="docker-$VERSION" BINARY_EXTENSION="$(export GOOS && binary_extension)" BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION" mkdir -p "$DEST/$GOOS/$GOARCH" TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME.tgz" # The staging directory for the files in the tgz BUILD_PATH="$DEST/build" # The directory that is at the root of the tar file TAR_BASE_DIRECTORY="docker" # $DEST/build/docker TAR_PATH="$BUILD_PATH/$TAR_BASE_DIRECTORY" # Copy the correct docker binary mkdir -p $TAR_PATH cp -L "$d/$BINARY_FULLNAME" "$TAR_PATH/docker$BINARY_EXTENSION" # copy over all the containerd binaries copy_containerd $TAR_PATH echo "Creating tgz from $BUILD_PATH and naming it $TGZ" tar --numeric-owner --owner 0 -C "$BUILD_PATH" -czf "$TGZ" $TAR_BASE_DIRECTORY hash_files "$TGZ" # cleanup after ourselves rm -rf "$BUILD_PATH" echo "Created tgz: $TGZ" done )