#!/usr/bin/env bash set -euo pipefail if [[ ${EUID} -ne 0 ]]; then echo "Run as root" >&2; exit 1; fi systemctl disable --now wgtools-certbot-renew.timer 2>/dev/null || true systemctl disable --now wgtools-certbot-renew.service 2>/dev/null || true systemctl disable --now wgtools-expiry.timer 2>/dev/null || true systemctl disable --now wgtools-expiry.service 2>/dev/null || true systemctl disable --now wgtools-telegram.service 2>/dev/null || true systemctl disable --now wgtools.service 2>/dev/null || true # The Nodes tunnel is an internal WGTools transport, not a user WireGuard server. systemctl disable --now wg-quick@wgnode0.service 2>/dev/null || true ip link delete wgnode0 2>/dev/null || true rm -f /etc/wireguard/wgnode0.conf # Detach local home-side Relay transports, but preserve /var/lib/wgtools so a # later reinstall/restore can reconnect to the same remote Relay tenants. for service in /etc/systemd/system/wgtools-relay-home-*.service; do [[ -e "$service" ]] || continue unit="$(basename "$service")" systemctl disable --now "$unit" 2>/dev/null || true rm -f "$service" done rm -f \ /etc/systemd/system/wgtools.service \ /etc/systemd/system/wgtools-telegram.service \ /etc/systemd/system/wgtools-expiry.service \ /etc/systemd/system/wgtools-expiry.timer \ /etc/systemd/system/wgtools-certbot-renew.service \ /etc/systemd/system/wgtools-certbot-renew.timer \ /etc/sudoers.d/wgtools \ /usr/local/libexec/wgtools-helper \ /usr/local/libexec/wgtools-certbot-reload \ /usr/local/bin/wgtools rm -rf /opt/wgtools /etc/wgtools systemctl daemon-reload systemctl reset-failed >/dev/null 2>&1 || true cat <<'TXT' WGTools removed. Preserved intentionally: /var/lib/wgtools WGTools users, settings, keys/metadata and backups /etc/wireguard Normal WireGuard configuration (internal wgnode0 removed) /etc/letsencrypt Let's Encrypt certificates WireGuard packages and normal wg-quick services Remote VPS Relay Agent/tenants Reinstalling WGTools can reuse the preserved state. For a destructive wipe of this host, use the "FULL CLEANUP" action from the wgtools menu before uninstalling, or run /opt/wgtools/scripts/full-clean.sh while WGTools is still installed. TXT