binary-daemon 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. set -e
  3. copy_binaries() {
  4. local dir="$1"
  5. local hash="$2"
  6. # Add nested executables to bundle dir so we have complete set of
  7. # them available, but only if the native OS/ARCH is the same as the
  8. # OS/ARCH of the build target
  9. if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
  10. return
  11. fi
  12. if [ ! -x /usr/local/bin/runc ]; then
  13. return
  14. fi
  15. echo "Copying nested executables into $dir"
  16. 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
  17. cp -f "$(command -v "$file")" "$dir/"
  18. if [ "$hash" = "hash" ]; then
  19. hash_files "$dir/$file"
  20. fi
  21. done
  22. # vpnkit is available for x86_64 and aarch64
  23. if command -v "vpnkit.$(uname -m)" 2>&1 > /dev/null; then
  24. cp -f "$(command -v "vpnkit.$(uname -m)")" "$dir/vpnkit"
  25. if [ "$hash" = "hash" ]; then
  26. hash_files "$dir/vpnkit"
  27. fi
  28. fi
  29. }
  30. [ -z "$KEEPDEST" ] && rm -rf "$DEST"
  31. (
  32. GO_PACKAGE='github.com/docker/docker/cmd/dockerd'
  33. BINARY_SHORT_NAME='dockerd'
  34. source "${MAKEDIR}/.binary"
  35. copy_binaries "$DEST" 'hash'
  36. )