Add install.sh

This commit is contained in:
2026-10-01 13:10:35 +02:00
parent e73673605e
commit 47d58f535e

28
install.sh Normal file
View File

@@ -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/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/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:-} </dev/null
code=$?
rm -rf "$dir"
[ "$code" -eq 0 ] || echo "Agent Hub's setup stopped: see above." >&2
return "$code"
}
agent_hub_install