#!/bin/sh set -eu TOKEN="${1:-}" if [ -z "$TOKEN" ]; then echo "Error: Sentry404 Agent token is required." echo echo "Usage:" echo "curl -fsSL https://install.sentry404.com | sudo sh -s -- AGENT_TOKEN" exit 1 fi if [ "$(id -u)" -ne 0 ]; then echo "Error: installer must be run as root." exit 1 fi if ! command -v apt-get >/dev/null 2>&1; then echo "Error: currently only Ubuntu/Debian systems are supported." exit 1 fi ARCH="$(dpkg --print-architecture)" case "$ARCH" in amd64) ;; *) echo "Error: unsupported architecture: $ARCH" exit 1 ;; esac echo "[1/6] Installing required packages..." apt-get update -qq apt-get install -y -qq ca-certificates curl echo "[2/6] Configuring Sentry404 repository..." install -m 0755 -d /etc/apt/keyrings curl -fsSL \ https://packages.sentry404.com/sentry404.asc \ -o /etc/apt/keyrings/sentry404.asc chmod a+r /etc/apt/keyrings/sentry404.asc cat > /etc/apt/sources.list.d/sentry404.sources < /etc/sentry404/agent.env </dev/null 2>&1 systemctl restart sentry404-agent.service echo "[6/6] Verifying installation..." sleep 2 if systemctl is-active --quiet sentry404-agent.service; then echo echo "Sentry404 Agent installed successfully." else echo echo "Error: Sentry404 Agent failed to start." echo "Check logs with:" echo " journalctl -u sentry404-agent -n 100 --no-pager" exit 1 fi