2017-02-13 11:01:54 -08:00
#!/usr/bin/env bash
2016-02-19 17:42:51 -05:00
set -e
2017-07-05 15:38:23 -04: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 02:23:38 +01:00
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
2017-07-05 15:38:23 -04:00
return
fi
2019-01-10 02:23:38 +01:00
if [ ! -x /usr/local/bin/runc ]; then
2017-07-05 15:38:23 -04:00
return
fi
echo "Copying nested executables into $dir"
2020-05-11 22:12:50 +09:00
for file in containerd containerd-shim containerd-shim-runc-v2 ctr runc docker-init docker-proxy rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh dockerd-rootless-setuptool.sh; do
2019-08-31 12:12:25 +02: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 15:38:23 -04:00
fi
done
2019-02-05 18:11:18 -08:00
2021-02-24 14:05:38 +09:00
# vpnkit is available for x86_64 and aarch64
2020-03-03 12:27:49 +09:00
if command -v "vpnkit.$(uname -m)" 2>&1 > /dev/null; then
2019-08-31 12:12:25 +02:00
cp -f "$(command -v "vpnkit.$(uname -m)")" "$dir/vpnkit"
if [ "$hash" = "hash" ]; then
2019-02-05 18:11:18 -08:00
hash_files "$dir/vpnkit"
fi
fi
2017-07-05 15:38:23 -04:00
}
2016-05-23 21:44:43 -04:00
2019-01-10 02:23:38 +01:00
[ -z "$KEEPDEST" ] && rm -rf "$DEST"
2017-07-05 15:38:23 -04:00
source "${MAKEDIR}/.binary"
copy_binaries "$DEST" 'hash'