2023-11-08 13:10:01 -05:00
|
|
|
#!/usr/bin/env bash
|
2023-11-13 12:46:20 -05:00
|
|
|
if [[ -f ./constellation ]]; then
|
2023-11-08 13:10:01 -05:00
|
|
|
echo "constellation CLI is already available."
|
|
|
|
exit 0
|
|
|
|
fi
|
2023-11-13 12:46:20 -05:00
|
|
|
|
2023-11-08 13:10:01 -05:00
|
|
|
os=$(uname -s)
|
|
|
|
arch=$(uname -m)
|
2023-11-13 12:46:20 -05:00
|
|
|
version=$1
|
2023-11-08 13:10:01 -05:00
|
|
|
url=""
|
2023-11-13 12:46:20 -05:00
|
|
|
|
|
|
|
echo "Fetching constellation ${version}"
|
|
|
|
|
2023-11-08 13:10:01 -05:00
|
|
|
if [[ ${os} == "Darwin" ]]; then
|
|
|
|
if [[ ${arch} == "arm64" ]]; then
|
2023-11-13 12:46:20 -05:00
|
|
|
url="https://github.com/edgelesssys/constellation/releases/${version}/download/constellation-darwin-arm64"
|
2023-11-08 13:10:01 -05:00
|
|
|
elif [[ ${arch} == "x86_64" ]]; then
|
2023-11-13 12:46:20 -05:00
|
|
|
url="https://github.com/edgelesssys/constellation/releases/${version}/download/constellation-darwin-amd64"
|
2023-11-08 13:10:01 -05:00
|
|
|
fi
|
|
|
|
elif [[ ${os} == "Linux" ]]; then
|
|
|
|
if [[ ${arch} == "x86_64" ]]; then
|
2023-11-13 12:46:20 -05:00
|
|
|
url="https://github.com/edgelesssys/constellation/releases/${version}/download/constellation-linux-amd64"
|
2023-11-08 13:10:01 -05:00
|
|
|
elif [[ ${arch} == "arm64" ]]; then
|
2023-11-13 12:46:20 -05:00
|
|
|
url="https://github.com/edgelesssys/constellation/releases/${version}/download/constellation-linux-arm64"
|
2023-11-08 13:10:01 -05:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z ${url} ]]; then
|
2023-11-13 12:46:20 -05:00
|
|
|
echo "os \"${os}\" and/or architecture \"${arch}\" is not supported."
|
2023-11-08 13:10:01 -05:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
curl -o constellation -L "${url}"
|
|
|
|
chmod +x constellation
|
|
|
|
fi
|