#!/bin/sh set -e REPO="defunkt/go-shout" GITEA_URL="https://git.nose.space" INSTALL_DIR="/usr/local/bin" OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) case "$ARCH" in x86_64|amd64) ARCH="amd64" ;; arm64|aarch64) ARCH="arm64" ;; *) echo "Unsupported architecture: $ARCH" && exit 1 ;; esac BINARY="shout-${OS}-${ARCH}" # Get latest release tag TAG=$(curl -sf "${GITEA_URL}/api/v1/repos/${REPO}/releases/latest" | \ grep -o '"tag_name":"[^"]*"' | head -1 | cut -d'"' -f4) if [ -z "$TAG" ]; then echo "Error: could not find latest release" exit 1 fi echo "Installing shout ${TAG}..." curl -sfL "${GITEA_URL}/${REPO}/releases/download/${TAG}/${BINARY}" -o shout if [ ! -s shout ]; then echo "Error: no binary available for ${OS}/${ARCH}" rm -f shout exit 1 fi chmod +x shout if [ -w "$INSTALL_DIR" ]; then mv shout "${INSTALL_DIR}/shout" else sudo mv shout "${INSTALL_DIR}/shout" fi echo "Installed shout ${TAG} to ${INSTALL_DIR}/shout"