Browse code

hack: restore copy_binaries func

This function is still useful for the dev environment.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>

CrazyMax authored on 2023/01/04 20:13:52
Showing 1 changed files
... ...
@@ -1,6 +1,29 @@
1 1
 #!/usr/bin/env bash
2 2
 set -e
3 3
 
4
+copy_binaries() {
5
+	local dir="${1:?}"
6
+
7
+	# Add nested executables to bundle dir so we have complete set of
8
+	# them available, but only if the native OS/ARCH is the same as the
9
+	# OS/ARCH of the build target
10
+	if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
11
+		return
12
+	fi
13
+	if [ ! -x /usr/local/bin/runc ]; then
14
+		return
15
+	fi
16
+	echo "Copying nested executables into $dir"
17
+	for file in containerd containerd-shim-runc-v2 ctr runc docker-init rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh dockerd-rootless-setuptool.sh; do
18
+		cp -f "$(command -v "$file")" "$dir/"
19
+	done
20
+	# vpnkit might not be available for the target platform, see vpnkit stage in
21
+	# the Dockerfile for more information.
22
+	if command -v vpnkit > /dev/null 2>&1; then
23
+		cp -f "$(command -v vpnkit)" "$dir/"
24
+	fi
25
+}
26
+
4 27
 [ -z "$KEEPDEST" ] && rm -rf "$DEST"
5 28
 
6 29
 (
... ...
@@ -8,4 +31,5 @@ set -e
8 8
 	GO_PACKAGE='github.com/docker/docker/cmd/dockerd'
9 9
 	BINARY_NAME='dockerd'
10 10
 	source "${MAKEDIR}/.binary"
11
+	copy_binaries "$DEST"
11 12
 )