flux: Fetch different binary for Darwin

This commit is contained in:
Björn Busse 2024-02-12 15:35:02 +01:00
parent 445312f356
commit 79d7163178
1 changed files with 27 additions and 6 deletions

View File

@ -18,10 +18,14 @@ FLUX_VERSION="2.2.1"
readonly FLUX_VERSION
FLUX_CHECKSUM="466756ca6b3437d30a6a5fb58e60f3e5a82d8291f3869cfc55b6f041962601b5"
readonly FLUX_CHECKSUM
FLUX_ARCHIVE="flux_${FLUX_VERSION}_linux_amd64.tar.gz"
readonly FLUX_ARCHIVE
FLUX_URL="https://github.com/fluxcd/flux2/releases/download/v${FLUX_VERSION}/${FLUX_ARCHIVE}"
readonly FLUX_URL
FLUX_ARCHIVE_LINUX="flux_${FLUX_VERSION}_linux_amd64.tar.gz"
readonly FLUX_ARCHIVE_LINUX
FLUX_ARCHIVE_MACOS="flux_${FLUX_VERSION}_darwin_arm64.tar.gz"
readonly FLUX_ARCHIVE_MACOS
FLUX_URL_LINUX="https://github.com/fluxcd/flux2/releases/download/v${FLUX_VERSION}/${FLUX_ARCHIVE_LINUX}"
readonly FLUX_URL_LINUX
FLUX_URL_MACOS="https://github.com/fluxcd/flux2/releases/download/v${FLUX_VERSION}/${FLUX_ARCHIVE_MACOS}"
readonly FLUX_URL_MACOS
FLUX_FORCE_LOCAL=1
readonly FLUX_FORCE_LOCAL
TF_VERSION="1.6.6"
@ -34,13 +38,30 @@ TF_URL="https://releases.hashicorp.com/terraform/${TF_VERSION}/${TF_ARCHIVE}"
readonly TF_URL
TF_FORCE_LOCAL=1
readonly TF_FORCE_LOCAL
OS="Linux"
VERBOSE=0
readonly VERBOSE
minikube_driver="podman"
if [[ $(uname) == "Darwin" ]]; then
OS="macos"
elif [[ $(grep '^ID=' /etc/os-release | awk -F'=' '{print $2}') == "ubuntu" ]]; then
OS="ubuntu"
fi
printf "Running on ${OS}\n"
if [[ "$OS" = "macos" ]]; then
FLUX_URL="${FLUX_URL_MACOS}"
FLUX_ARCHIVE="${FLUX_ARCHIVE_MACOS}"
else
FLUX_URL="${FLUX_URL_LINUX}"
FLUX_ARCHIVE="${FLUX_ARCHIVE_MACOS}"
fi
# We prefer podman but Ubuntu's podman is too old
if [[ $(grep '^ID=' /etc/os-release | awk -F'=' '{print $2}') == "ubuntu" ]]; then
if [[ ${OS} = "ubuntu" ]]; then
minikube_driver="docker"
fi
@ -70,7 +91,7 @@ else
printf 'k8s dashboard is already running\n'
fi
# Install flux if local version enforced
# Install terraform if local version enforced
if [[ "$TF_FORCE_LOCAL" = 1 ]]; then
printf "Fetching terraform archive..\n"
curl -LO "${TF_URL}"