#!/bin/sh # Node 7 / Hektor CLI installer (Hub-hosted). # Usage: # curl -fsSL https://node7.zeroshot.studio/install.sh | sh # Override hub: NODE7_HUB_URL=https://host curl ... | sh # Local binary: PREFIX=$HOME/.local ./scripts/install-hektor.sh set -eu HUB="${NODE7_HUB_URL:-https://node7.zeroshot.studio}" HUB="${HUB%/}" PREFIX="${PREFIX:-$HOME/.local}" BIN_DIR="${PREFIX}/bin" os=$(uname -s | tr "[:upper:]" "[:lower:]") arch=$(uname -m) case "$arch" in x86_64|amd64) arch=amd64 ;; arm64|aarch64) arch=arm64 ;; *) echo "install-hektor: unsupported arch $arch" >&2 exit 1 ;; esac case "$os" in darwin|linux) ;; msys*|mingw*|cygwin*) os=windows ;; *) echo "install-hektor: unsupported OS $os" >&2 exit 1 ;; esac asset="hektor-cli-${os}-${arch}" if [ "$os" = "windows" ]; then asset="${asset}.exe" fi mkdir -p "$BIN_DIR" dest="$BIN_DIR/hektor" url="${HUB}/packs/${asset}" echo "install-hektor: fetching ${asset} from ${HUB}" if ! command -v curl >/dev/null 2>&1; then echo "install-hektor: curl required" >&2 exit 1 fi tmp=$(mktemp) trap "rm -f \"$tmp\"" EXIT if ! curl -fsSL -o "$tmp" "$url"; then echo "install-hektor: download failed: ${url}" >&2 echo "Build from source:" >&2 echo " cd client && go build -o hektor-cli ." >&2 echo " install hektor-cli ${dest}" >&2 exit 1 fi chmod +x "$tmp" mv "$tmp" "$dest" trap - EXIT echo "installed $dest" echo "Add ${BIN_DIR} to PATH if needed." "$dest" --install-daemon >/dev/null 2>&1 || true echo "Daily update check: hektor --check-updates" echo "Drops signed packs in: \${XDG_CONFIG_HOME:-~/.config}/node7/inbox/*.zip" echo "Catalog fetch uses NODE7_CATALOG_URL or the Hub /catalog.json"