2013-12-02 15:48:26 -07:00
|
|
|
#!/bin/bash
|
2013-10-17 23:40:41 -06:00
|
|
|
|
|
|
|
DEST=$1
|
|
|
|
|
|
|
|
# dockerinit still needs to be a static binary, even if docker is dynamic
|
2014-03-06 13:39:17 -07:00
|
|
|
CGO_ENABLED=0 go build -o $DEST/dockerinit-$VERSION -ldflags "$LDFLAGS -d" "${BUILDFLAGS[@]}" ./dockerinit
|
2013-10-17 23:40:41 -06:00
|
|
|
echo "Created binary: $DEST/dockerinit-$VERSION"
|
|
|
|
ln -sf dockerinit-$VERSION $DEST/dockerinit
|
|
|
|
|
2014-02-13 10:07:53 -07:00
|
|
|
sha1sum=
|
|
|
|
if command -v sha1sum &> /dev/null; then
|
|
|
|
sha1sum=sha1sum
|
|
|
|
elif command -v shasum &> /dev/null; then
|
|
|
|
# Mac OS X - why couldn't they just use the same command name and be happy?
|
|
|
|
sha1sum=shasum
|
|
|
|
else
|
|
|
|
echo >&2 'error: cannot find sha1sum command or equivalent'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-10-17 23:40:41 -06:00
|
|
|
# sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another
|
2014-02-13 10:07:53 -07:00
|
|
|
export DOCKER_INITSHA1="$($sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)"
|
2013-10-17 23:40:41 -06:00
|
|
|
# exported so that "dyntest" can easily access it later without recalculating it
|
|
|
|
|
2013-12-08 18:40:05 -07:00
|
|
|
(
|
2014-02-11 17:26:54 -07:00
|
|
|
export LDFLAGS_STATIC="-X github.com/dotcloud/docker/dockerversion.INITSHA1 \"$DOCKER_INITSHA1\" -X github.com/dotcloud/docker/dockerversion.INITPATH \"$DOCKER_INITPATH\""
|
2013-12-08 18:40:05 -07:00
|
|
|
source "$(dirname "$BASH_SOURCE")/binary"
|
|
|
|
)
|