#!/bin/bash # uninstall.sh — remove adguard-register from this host # Run as root (or with sudo): ./uninstall.sh set -euo pipefail INSTALL_PATH="/usr/local/bin/adguard-register" SERVICE_PATH="/etc/systemd/system/adguard-register.service" if [ "$(id -u)" -ne 0 ]; then echo "ERROR: This script must be run as root (use sudo)" exit 1 fi echo "=== Uninstalling adguard-register ===" # Stop and disable service (ignore errors if not installed) systemctl stop adguard-register.service 2>/dev/null || true systemctl disable adguard-register.service 2>/dev/null || true rm -f "${SERVICE_PATH}" systemctl daemon-reload echo "→ Removed systemd service" # Remove script rm -f "${INSTALL_PATH}" echo "→ Removed ${INSTALL_PATH}" echo "" echo "=== Uninstall complete ===" echo "NOTE: Existing DNS rewrites in AdGuard Home were NOT removed." echo "To clean up entries, use the AdGuard Home web UI or API directly."