2017-02-13 19:01:54 +00:00
#!/usr/bin/env bash
2016-02-19 22:42:51 +00:00
set -e
2017-07-05 19:38:23 +00:00
copy_binaries() {
local dir="$1"
local hash="$2"
# Add nested executables to bundle dir so we have complete set of
# them available, but only if the native OS/ARCH is the same as the
# OS/ARCH of the build target
2019-01-10 01:23:38 +00:00
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
2017-07-05 19:38:23 +00:00
return
fi
2019-01-10 01:23:38 +00:00
if [ ! -x /usr/local/bin/runc ]; then
2017-07-05 19:38:23 +00:00
return
fi
echo "Copying nested executables into $dir"
2021-04-06 23:32:46 +00:00
for file in containerd containerd-shim containerd-shim-runc-v2 ctr runc docker-init rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh dockerd-rootless-setuptool.sh; do
2019-08-31 10:12:25 +00:00
cp -f "$(command -v "$file")" "$dir/"
if [ "$hash" = "hash" ]; then
2018-09-25 16:56:40 +00:00
hash_files "$dir/$file"
2017-07-05 19:38:23 +00:00
fi
done
2019-02-06 02:11:18 +00:00
2021-02-24 05:05:38 +00:00
# vpnkit is available for x86_64 and aarch64
2020-03-03 03:27:49 +00:00
if command -v "vpnkit.$(uname -m)" 2>&1 > /dev/null; then
2019-08-31 10:12:25 +00:00
cp -f "$(command -v "vpnkit.$(uname -m)")" "$dir/vpnkit"
if [ "$hash" = "hash" ]; then
2019-02-06 02:11:18 +00:00
hash_files "$dir/vpnkit"
fi
fi
2017-07-05 19:38:23 +00:00
}
2016-05-24 01:44:43 +00:00
2019-01-10 01:23:38 +00:00
[ -z "$KEEPDEST" ] && rm -rf "$DEST"
2021-04-06 23:32:46 +00:00
(
GO_PACKAGE='github.com/docker/docker/cmd/dockerd'
BINARY_SHORT_NAME='dockerd'
source "${MAKEDIR}/.binary"
copy_binaries "$DEST" 'hash'
)