From 471d00f697ecd92d9965d1cd498431c961707a73 Mon Sep 17 00:00:00 2001 From: "bjorn.englesson" Date: Thu, 1 Oct 2026 10:14:07 +0200 Subject: [PATCH] Add install.sh --- install.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..07a7989 --- /dev/null +++ b/install.sh @@ -0,0 +1,28 @@ +#!/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-test/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 page'\''s PowerShell line.' >&2 + return 1 + fi + 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-test/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-test: 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-test'" (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