@@ -4,18 +4,42 @@ set -ex
44
55ARCH=$1
66
7- # Download custom s5cmd binary built with Go 1.25.4
7+ # Install jq if not available (for lmi container)
8+ if ! command -v jq & > /dev/null; then
9+ apt-get update && apt-get install -y jq
10+ fi
11+
12+ # Retrieve latest patched version
13+ GO_MAJOR_MINOR=" 1.25"
14+ GO_VERSION=$( curl -s https://go.dev/dl/? mode=json | jq -r " .[].version" | grep " ^go${GO_MAJOR_MINOR} " | head -1 | sed ' s/go//' )
15+ echo " Using Go version: ${GO_VERSION} (latest in ${GO_MAJOR_MINOR} .x series)"
16+
817if [[ $ARCH == " aarch64" ]]; then
9- curl -f https://publish.djl.ai/s5cmd/go1.25.4/s5cmd-linux- arm64 -L -o s5cmd
18+ GO_ARCH= " arm64"
1019else
11- curl -f https://publish.djl.ai/s5cmd/go1.25.4/s5cmd-linux- amd64 -L -o s5cmd
20+ GO_ARCH= " amd64"
1221fi
1322
14- INSTALL_DIR=" /opt/djl/bin"
23+ curl -fsSL " https://go.dev/dl/go${GO_VERSION} .linux-${GO_ARCH} .tar.gz" | tar -xz -C /tmp
24+ export PATH=" /tmp/go/bin:${PATH} "
25+ export GOPATH=" /tmp/gopath"
26+ export GOCACHE=" /tmp/gocache"
1527
28+ # Download s5cmd release source
29+ S5CMD_VERSION=" v2.3.0"
30+ echo " Building s5cmd ${S5CMD_VERSION} "
31+ curl -fsSL " https://github.com/peak/s5cmd/archive/refs/tags/${S5CMD_VERSION} .tar.gz" | tar -xz -C /tmp
32+ mv /tmp/s5cmd-${S5CMD_VERSION# v} /tmp/s5cmd
33+ cd /tmp/s5cmd
34+ go build -ldflags " -X github.com/peak/s5cmd/v2/version.Version=${S5CMD_VERSION} " -o s5cmd .
35+
36+ # Install s5cmd
37+ INSTALL_DIR=" /opt/djl/bin"
1638mkdir -p " ${INSTALL_DIR} "
1739mv s5cmd " ${INSTALL_DIR} /"
1840chmod +x " ${INSTALL_DIR} /s5cmd"
1941
42+ rm -rf /tmp/go /tmp/gopath /tmp/gocache /tmp/s5cmd
43+
2044export PATH=" ${INSTALL_DIR} :${PATH} "
2145echo " export PATH=${INSTALL_DIR} :\$ PATH" >> ~/.bashrc
0 commit comments