#!/usr/bin/env bash
# Installs or upgrades Calisto. Run in Azure Cloud Shell (Bash), signed in to the subscription
# Calisto should live in:
#
#   curl -sL https://calisto.run/install.sh | bash
#   curl -sL https://calisto.run/install.sh | bash -s -- --subscription <id> --region australiaeast
#
# This fetches the installer published in https://github.com/abhijitsghosh/calisto-install and
# runs it with the options you give. Every option is described at https://calisto.run/running.html.
set -euo pipefail
BASE="${CALISTO_BASE:-https://raw.githubusercontent.com/abhijitsghosh/calisto-install/main/deploy}"
INSTALLER="$(mktemp)"
trap 'rm -f "$INSTALLER"' EXIT
curl -fsSL "$BASE/install.sh" -o "$INSTALLER" || { echo "ERROR: could not download the installer from $BASE"; exit 1; }
CALISTO_BASE="$BASE" bash "$INSTALLER" "$@"
