2023-11-10 21:58:44 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-02-17 05:20:14 +01:00
|
|
|
# Needed for evergreen scripts that use evergreen expansions and utility methods.
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
|
|
|
|
. "$DIR/prelude.sh"
|
|
|
|
|
2023-08-29 18:04:28 +02:00
|
|
|
cd src
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o verbose
|
|
|
|
|
2024-03-02 04:23:17 +01:00
|
|
|
mkdir -p $TMPDIR
|
|
|
|
|
2023-11-10 21:58:44 +01:00
|
|
|
EXT=""
|
|
|
|
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" || "$OSTYPE" == "win64" ]]; then
|
|
|
|
OS="windows"
|
|
|
|
EXT=".exe"
|
2023-11-16 18:53:18 +01:00
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
OS="darwin"
|
2023-11-10 21:58:44 +01:00
|
|
|
else
|
|
|
|
OS="linux"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
if [[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]]; then
|
|
|
|
ARCH="arm64"
|
2024-02-17 05:20:14 +01:00
|
|
|
elif [[ "$ARCH" == "ppc64le" || "$ARCH" == "ppc64" || "$ARCH" == "ppc" || "$ARCH" == "ppcle" ]]; then
|
|
|
|
ARCH="ppc64le"
|
2024-03-06 00:43:02 +01:00
|
|
|
elif [[ "$ARCH" == "s390x" || "$ARCH" == "s390" ]]; then
|
|
|
|
ARCH="s390x"
|
2023-11-10 21:58:44 +01:00
|
|
|
else
|
|
|
|
ARCH="amd64"
|
|
|
|
fi
|
|
|
|
|
2024-03-06 00:43:02 +01:00
|
|
|
mkdir -p $TMPDIR
|
|
|
|
|
2024-02-17 05:20:14 +01:00
|
|
|
# TODO(SERVER-86050): remove the branch once bazelisk is built on s390x & ppc64le
|
2024-03-06 00:43:02 +01:00
|
|
|
if [[ $ARCH == "ppc64le" ]] || [[ $ARCH == "s390x" ]]; then
|
2024-11-01 21:26:33 +01:00
|
|
|
REMOTE_PATH=https://mdb-build-public.s3.amazonaws.com/bazel-binaries/bazel-7.2.1-${ARCH}
|
2024-02-17 05:20:14 +01:00
|
|
|
LOCAL_PATH=$TMPDIR/bazel
|
|
|
|
else
|
2024-02-29 01:18:13 +01:00
|
|
|
REMOTE_PATH=https://mdb-build-public.s3.amazonaws.com/bazelisk-binaries/v1.19.0/bazelisk-${OS}-${ARCH}${EXT}
|
2024-02-17 05:20:14 +01:00
|
|
|
LOCAL_PATH=$TMPDIR/bazelisk
|
|
|
|
fi
|
|
|
|
|
2024-03-05 22:15:48 +01:00
|
|
|
# Delete any previously downloaded bazel/bazelisk bin in case that would get in the way of the curl request below
|
2024-03-02 04:23:17 +01:00
|
|
|
if [ -f "$LOCAL_PATH" ]; then
|
|
|
|
rm $LOCAL_PATH
|
|
|
|
fi
|
|
|
|
|
2024-02-17 05:20:14 +01:00
|
|
|
CURL_COMMAND="curl -L $REMOTE_PATH --output $LOCAL_PATH"
|
2023-11-10 21:58:44 +01:00
|
|
|
|
|
|
|
echo $CURL_COMMAND
|
|
|
|
eval $CURL_COMMAND
|
|
|
|
|
2024-02-17 05:20:14 +01:00
|
|
|
chmod +x $LOCAL_PATH
|