-
Notifications
You must be signed in to change notification settings - Fork 72
/
setup.sh
executable file
·51 lines (41 loc) · 1.55 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
PLATFORM=${1:-"linux"}
ARCH=${2:-"amd64"}
BINARY_VERSION_FILE="./binary-version.json"
dockerVersion=$(jq -r '.docker' < "${BINARY_VERSION_FILE}")
kubectlVersion=$(jq -r '.kubectl' < "${BINARY_VERSION_FILE}")
mingitVersion=$(jq -r '.mingit' < "${BINARY_VERSION_FILE}")
mkdir -p dist/
echo "Checking and downloading binaries for docker ${dockerVersion}, kubectl ${kubectlVersion} and mingit ${mingitVersion} (Windows only)"
# Determine the binary file names based on the platform
dockerBinary="dist/docker"
kubectlBinary="dist/kubectl"
if [ "$PLATFORM" == "windows" ]; then
dockerBinary="dist/docker.exe"
kubectlBinary="dist/kubectl.exe"
fi
# Check and download docker binary
if [ ! -f "$dockerBinary" ]; then
echo "Downloading docker binary..."
/usr/bin/env bash ./build/download_docker_binary.sh "$PLATFORM" "$ARCH" "$dockerVersion"
else
echo "Docker binary already exists, skipping download."
fi
# Check and download kubectl binary
if [ ! -f "$kubectlBinary" ]; then
echo "Downloading kubectl binary..."
/usr/bin/env bash ./build/download_kubectl_binary.sh "$PLATFORM" "$ARCH" "$kubectlVersion"
else
echo "Kubectl binary already exists, skipping download."
fi
# Check and download mingit binary
if [ "$PLATFORM" == "windows" ]; then
if [ ! -f "dist/mingit" ]; then
echo "Downloading mingit binary..."
/usr/bin/env bash ./build/download_mingit_binary.sh "$PLATFORM" "$ARCH" "$mingitVersion"
else
echo "Mingit binary already exists, skipping download."
fi
fi