2013-12-02 22:48:26 +00:00
|
|
|
#!/bin/bash
|
2013-11-18 03:24:49 +00:00
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
CROSS="$DEST/../cross"
|
2013-11-18 03:24:49 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
if [ ! -d "$CROSS/linux/amd64" ]; then
|
|
|
|
echo >&2 'error: binary and cross must be run before tgz'
|
2013-11-18 03:24:49 +00:00
|
|
|
false
|
|
|
|
fi
|
|
|
|
|
2016-03-22 21:12:29 +00:00
|
|
|
(
|
2013-12-24 06:31:53 +00:00
|
|
|
for d in "$CROSS/"*/*; do
|
2016-03-22 21:12:29 +00:00
|
|
|
export GOARCH="$(basename "$d")"
|
|
|
|
export GOOS="$(basename "$(dirname "$d")")"
|
2016-05-24 01:44:43 +00:00
|
|
|
|
|
|
|
source "${MAKEDIR}/.binary-setup"
|
|
|
|
|
|
|
|
BINARY_NAME="${DOCKER_CLIENT_BINARY_NAME}-$VERSION"
|
|
|
|
DAEMON_BINARY_NAME="${DOCKER_DAEMON_BINARY_NAME}-$VERSION"
|
2016-06-03 16:28:14 +00:00
|
|
|
PROXY_BINARY_NAME="${DOCKER_PROXY_BINARY_NAME}-$VERSION"
|
2015-01-13 02:07:16 +00:00
|
|
|
BINARY_EXTENSION="$(export GOOS && binary_extension)"
|
2016-03-31 16:27:50 +00:00
|
|
|
if [ "$GOOS" = 'windows' ]; then
|
|
|
|
# if windows use a zip, not tgz
|
|
|
|
BUNDLE_EXTENSION=".zip"
|
|
|
|
IS_TAR="false"
|
|
|
|
else
|
|
|
|
BUNDLE_EXTENSION=".tgz"
|
|
|
|
IS_TAR="true"
|
|
|
|
fi
|
2014-12-16 10:05:12 +00:00
|
|
|
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
|
2016-04-23 22:26:05 +00:00
|
|
|
DAEMON_BINARY_FULLNAME="$DAEMON_BINARY_NAME$BINARY_EXTENSION"
|
2016-06-03 16:28:14 +00:00
|
|
|
PROXY_BINARY_FULLNAME="$PROXY_BINARY_NAME$BINARY_EXTENSION"
|
2013-12-24 06:31:53 +00:00
|
|
|
mkdir -p "$DEST/$GOOS/$GOARCH"
|
2016-03-31 16:27:50 +00:00
|
|
|
TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME$BUNDLE_EXTENSION"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2016-03-29 18:39:28 +00:00
|
|
|
# The staging directory for the files in the tgz
|
|
|
|
BUILD_PATH="$DEST/build"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2016-03-29 18:39:28 +00:00
|
|
|
# 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
|
2016-05-24 01:44:43 +00:00
|
|
|
cp -L "$d/$BINARY_FULLNAME" "$TAR_PATH/${DOCKER_CLIENT_BINARY_NAME}${BINARY_EXTENSION}"
|
2016-04-23 22:26:05 +00:00
|
|
|
if [ -f "$d/$DAEMON_BINARY_FULLNAME" ]; then
|
2016-05-24 01:44:43 +00:00
|
|
|
cp -L "$d/$DAEMON_BINARY_FULLNAME" "$TAR_PATH/${DOCKER_DAEMON_BINARY_NAME}${BINARY_EXTENSION}"
|
2016-04-23 22:26:05 +00:00
|
|
|
fi
|
2016-06-03 16:28:14 +00:00
|
|
|
if [ -f "$d/$PROXY_BINARY_FULLNAME" ]; then
|
|
|
|
cp -L "$d/$PROXY_BINARY_FULLNAME" "$TAR_PATH/${DOCKER_PROXY_BINARY_NAME}${BINARY_EXTENSION}"
|
|
|
|
fi
|
2016-03-29 18:39:28 +00:00
|
|
|
|
|
|
|
# copy over all the containerd binaries
|
|
|
|
copy_containerd $TAR_PATH
|
|
|
|
|
2016-03-31 16:27:50 +00:00
|
|
|
if [ "$IS_TAR" == "true" ]; then
|
|
|
|
echo "Creating tgz from $BUILD_PATH and naming it $TGZ"
|
|
|
|
tar --numeric-owner --owner 0 -C "$BUILD_PATH" -czf "$TGZ" $TAR_BASE_DIRECTORY
|
|
|
|
else
|
|
|
|
# ZIP needs to full absolute dir path, not the absolute path
|
|
|
|
ZIP=`pwd`"/$TGZ"
|
|
|
|
# keep track of where we are, for later.
|
|
|
|
pushd .
|
|
|
|
# go into the BUILD_PATH since zip does not have a -C equivalent.
|
|
|
|
cd $BUILD_PATH
|
|
|
|
echo "Creating zip from $BUILD_PATH and naming it $ZIP"
|
|
|
|
zip -q -r $ZIP $TAR_BASE_DIRECTORY
|
|
|
|
# go back to where we started
|
|
|
|
popd
|
|
|
|
fi
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
hash_files "$TGZ"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2016-03-29 18:39:28 +00:00
|
|
|
# cleanup after ourselves
|
|
|
|
rm -rf "$BUILD_PATH"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
echo "Created tgz: $TGZ"
|
|
|
|
done
|
2016-03-22 21:12:29 +00:00
|
|
|
)
|