#!/bin/sh # curl -fsSL https://hoq.app/keel/install.sh | sh -s -- --agent --name --subject [...] set -eu BASE="${KEEL_UPDATE_URL:-https://hoq.app/keel}" case "$(uname -s)-$(uname -m)" in Darwin-*) P=darwin-universal ;; Linux-x86_64) P=linux-x86_64 ;; Linux-aarch64|Linux-arm64) P=linux-aarch64 ;; *) echo "Keel has no build for $(uname -s) $(uname -m)" >&2; exit 1 ;; esac command -v python3 >/dev/null || { echo "python3 is needed (on a Mac, run: xcode-select --install)" >&2; exit 1; } T=$(mktemp -d) trap 'rm -rf "$T"' EXIT curl -fsSL "$BASE/latest.json?t=$(date +%s)" -o "$T/latest.json" set -- "$P" "$@" FILE=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["platforms"][sys.argv[2]]["file"])' "$T/latest.json" "$1") SUM=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["platforms"][sys.argv[2]]["sha256"])' "$T/latest.json" "$1") shift case "$FILE" in */*|*..*) echo "the release list is malformed" >&2; exit 1 ;; esac echo "fetching $FILE" curl -fsSL "$BASE/$FILE" -o "$T/keel.tar.gz" GOT=$( (sha256sum "$T/keel.tar.gz" 2>/dev/null || shasum -a 256 "$T/keel.tar.gz") | cut -d' ' -f1) [ "$GOT" = "$SUM" ] || { echo "the download does not match its published checksum; stopping" >&2; exit 1; } tar -xzf "$T/keel.tar.gz" -C "$T" sh "$T/keel-bundle/install.sh" "$@"