#!/bin/sh # Agent Hub's install: installs the newest Agent Hub for this user and opens it; running it again updates (HUB-10). # Its line: curl -fsSL https://git.bengles.se/agent-hub/releases/raw/branch/main/install.sh | sh # AGENT_HUB_SETUP_ARGS, when set, is added to the setup's arguments, e.g. --no-start. agent_hub_install() { if [ "$(uname -s)" != Linux ] || [ "$(uname -m)" != x86_64 ]; then echo 'This line installs Agent Hub on Linux (x86_64). On Windows, run the PowerShell line instead.' >&2 return 1 fi glibc=$(getconf GNU_LIBC_VERSION 2>/dev/null) || glibc= case "${glibc#glibc }" in 2.[0-9]|2.[12][0-9]|2.3[0-4]) echo "Agent Hub needs glibc 2.35 or newer; this system has ${glibc#glibc }." >&2; return 1 ;; esac command -v curl >/dev/null 2>&1 || { echo 'Installing Agent Hub needs curl.' >&2; return 1; } dir=$(mktemp -d) || return 1 exe="$dir/agent-hub-setup-linux" echo 'Downloading Agent Hub...' status=$(curl -sSL -o "$exe" -w '%{http_code}' 'https://git.bengles.se/agent-hub/releases/releases/download/latest/agent-hub-setup-linux') || status=${status:-000} case "$status" in 200) ;; 404) echo 'Can'\''t download Agent Hub from git.bengles.se/agent-hub/releases: it has no release yet. Try again in a minute.' >&2; rm -rf "$dir"; return 1 ;; *) echo 'Can'\''t download Agent Hub from git.bengles.se/agent-hub/releases'" (HTTP $status). "'Try again in a minute.' >&2; rm -rf "$dir"; return 1 ;; esac chmod +x "$exe" echo 'Installing Agent Hub...' "$exe" ${AGENT_HUB_SETUP_ARGS:-} &2 return "$code" } agent_hub_install