2013-12-02 17:48:26 -05:00
|
|
|
#!/bin/bash
|
2013-11-17 22:24:49 -05:00
|
|
|
|
|
|
|
DEST="$1"
|
2013-12-24 01:31:53 -05:00
|
|
|
CROSS="$DEST/../cross"
|
2013-11-17 22:24:49 -05:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
if [ ! -d "$CROSS/linux/amd64" ]; then
|
|
|
|
echo >&2 'error: binary and cross must be run before tgz'
|
2013-11-17 22:24:49 -05:00
|
|
|
false
|
|
|
|
fi
|
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
for d in "$CROSS/"*/*; do
|
|
|
|
GOARCH="$(basename "$d")"
|
|
|
|
GOOS="$(basename "$(dirname "$d")")"
|
2014-12-16 05:05:12 -05:00
|
|
|
BINARY_NAME="docker-$VERSION"
|
2015-01-12 21:07:16 -05:00
|
|
|
BINARY_EXTENSION="$(export GOOS && binary_extension)"
|
2014-12-16 05:05:12 -05:00
|
|
|
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
|
2013-12-24 01:31:53 -05:00
|
|
|
mkdir -p "$DEST/$GOOS/$GOARCH"
|
2014-12-16 05:05:12 -05:00
|
|
|
TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME.tgz"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
mkdir -p "$DEST/build"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
mkdir -p "$DEST/build/usr/local/bin"
|
2014-12-16 22:55:20 -05:00
|
|
|
cp -L "$d/$BINARY_FULLNAME" "$DEST/build/usr/local/bin/docker$BINARY_EXTENSION"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
tar --numeric-owner --owner 0 -C "$DEST/build" -czf "$TGZ" usr
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2014-03-19 21:58:39 -04:00
|
|
|
hash_files "$TGZ"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
rm -rf "$DEST/build"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2013-12-24 01:31:53 -05:00
|
|
|
echo "Created tgz: $TGZ"
|
|
|
|
done
|