2016-01-04 21:50:15 -08:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Retrieve OS/ARCH of docker daemon, eg. linux/amd64
|
2016-01-11 18:16:40 -05:00
|
|
|
export DOCKER_ENGINE_OSARCH="$(docker version | awk '
|
2016-01-04 21:50:15 -08:00
|
|
|
$1 == "Client:" { server = 0; next }
|
|
|
|
$1 == "Server:" { server = 1; next }
|
2016-01-11 18:16:40 -05:00
|
|
|
server && $1 == "OS/Arch:" { print $2 }
|
2016-01-04 21:50:15 -08:00
|
|
|
')"
|
|
|
|
export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}"
|
|
|
|
export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}"
|
2015-11-23 20:00:43 +01:00
|
|
|
DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:=amd64}
|
2016-01-04 21:50:15 -08:00
|
|
|
|
|
|
|
# and the client, just in case
|
2016-01-11 18:16:40 -05:00
|
|
|
export DOCKER_CLIENT_OSARCH="$(docker version | awk '
|
2016-01-04 21:50:15 -08:00
|
|
|
$1 == "Client:" { client = 1; next }
|
|
|
|
$1 == "Server:" { client = 0; next }
|
2016-01-11 18:16:40 -05:00
|
|
|
client && $1 == "OS/Arch:" { print $2 }
|
2016-01-04 21:50:15 -08:00
|
|
|
')"
|
2015-11-23 20:00:43 +01:00
|
|
|
|
|
|
|
# Retrieve the architecture used in contrib/builder/(deb|rpm)/$PACKAGE_ARCH/
|
|
|
|
PACKAGE_ARCH="amd64"
|
|
|
|
case "$DOCKER_ENGINE_OSARCH" in
|
|
|
|
linux/arm)
|
|
|
|
PACKAGE_ARCH='armhf'
|
|
|
|
;;
|
|
|
|
linux/ppc64le)
|
|
|
|
PACKAGE_ARCH='ppc64le'
|
|
|
|
;;
|
|
|
|
linux/s390x)
|
|
|
|
PACKAGE_ARCH='s390x'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
export PACKAGE_ARCH
|