2017-02-13 14:01:54 -05: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-09 20:23:38 -05: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-09 20:23:38 -05:00
|
|
|
if [ ! -x /usr/local/bin/runc ]; then
|
2017-07-05 15:38:23 -04:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo "Copying nested executables into $dir"
|
2019-03-20 13:11:31 -04:00
|
|
|
for file in containerd containerd-shim ctr runc docker-init docker-proxy rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh; do
|
2019-08-31 06:12:25 -04:00
|
|
|
cp -f "$(command -v "$file")" "$dir/"
|
|
|
|
if [ "$hash" = "hash" ]; then
|
2018-09-25 12:56:40 -04:00
|
|
|
hash_files "$dir/$file"
|
2017-07-05 15:38:23 -04:00
|
|
|
fi
|
|
|
|
done
|
2019-02-05 21:11:18 -05:00
|
|
|
|
|
|
|
# vpnkit is amd64 only
|
2019-08-31 06:12:25 -04:00
|
|
|
if command -v "vpnkit.$(uname -m)" 2>&1 >/dev/null; then
|
|
|
|
cp -f "$(command -v "vpnkit.$(uname -m)")" "$dir/vpnkit"
|
|
|
|
if [ "$hash" = "hash" ]; then
|
2019-02-05 21:11:18 -05: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-09 20:23:38 -05:00
|
|
|
[ -z "$KEEPDEST" ] && rm -rf "$DEST"
|
2017-07-05 15:38:23 -04:00
|
|
|
source "${MAKEDIR}/.binary"
|
|
|
|
copy_binaries "$DEST" 'hash'
|