#!/bin/bash # Installation script for Gogs MCP Server systemd service set -e echo "Installing Gogs MCP Server systemd service..." # Check if running as root if [ "$EUID" -ne 0 ]; then echo "This script must be run as root (use sudo)" exit 1 fi # Get the directory where this script is located SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Copy service file to systemd directory echo "Copying service file to /etc/systemd/system/..." cp "$SCRIPT_DIR/gogs-mcp-server.service" /etc/systemd/system/ # Reload systemd daemon echo "Reloading systemd daemon..." systemctl daemon-reload # Enable the service to start on boot echo "Enabling service to start on boot..." systemctl enable gogs-mcp-server echo "" echo "Installation complete!" echo "" echo "Before starting the service, please edit the configuration:" echo " sudo nano /etc/systemd/system/gogs-mcp-server.service" echo "" echo "Update these environment variables:" echo " - GOGS_SERVER_URL (your Gogs server URL)" echo " - GOGS_ACCESS_TOKEN (your Gogs access token)" echo "" echo "Then reload and start the service:" echo " sudo systemctl daemon-reload" echo " sudo systemctl start gogs-mcp-server" echo " sudo systemctl status gogs-mcp-server" echo "" echo "View logs with:" echo " sudo journalctl -u gogs-mcp-server -f" echo ""