From f0a674fba45a28b26ad682fcfc2348a60fe7202d Mon Sep 17 00:00:00 2001 From: Ednunp Date: Fri, 15 May 2026 17:24:23 +0100 Subject: [PATCH] =?UTF-8?q?server:=20update=20to=20v2.3=20=E2=80=94=20dual?= =?UTF-8?q?-protocol=20relay=20(v1=20pair=20+=20v2=20lobby)=20+=20auto-upd?= =?UTF-8?q?ater=20with=20EXIT=20trap=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/uninstall.sh | 55 ++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/server/uninstall.sh b/server/uninstall.sh index 308e30f..668a773 100644 --- a/server/uninstall.sh +++ b/server/uninstall.sh @@ -1,12 +1,14 @@ #!/bin/bash -# uninstall.sh — Remove the RemSound UDP relay cleanly. +# uninstall.sh — Remove the RemSound UDP relay and its auto-updater cleanly. # # Run with sudo: # sudo ./uninstall.sh # -# Stops the service, disables it, removes the script and unit file, and -# leaves the log file in place (rename or delete it yourself if you don't -# want it kept). Does NOT touch your router port-forward — that's separate. +# Stops and disables both the relay and the updater timer, removes their +# scripts and unit files, and removes the /etc/remsound-relay/ state dir +# (version file + rollback backups). Leaves log files in place — rename or +# delete them yourself if you don't want them kept. Does NOT touch your +# router port-forward — that's separate. set -euo pipefail @@ -15,26 +17,47 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi +# Stop the updater timer first so it can't fire mid-uninstall. +if systemctl list-unit-files remsound-relay-update.timer >/dev/null 2>&1; then + echo "Stopping remsound-relay-update.timer ..." + systemctl stop remsound-relay-update.timer 2>/dev/null || true + systemctl disable remsound-relay-update.timer 2>/dev/null || true +fi + +if systemctl list-unit-files remsound-relay-update.service >/dev/null 2>&1; then + systemctl stop remsound-relay-update.service 2>/dev/null || true +fi + if systemctl list-unit-files remsound-relay.service >/dev/null 2>&1; then - echo "Stopping remsound-relay ..." - systemctl stop remsound-relay.service || true - echo "Disabling remsound-relay ..." - systemctl disable remsound-relay.service >/dev/null 2>&1 || true + echo "Stopping remsound-relay.service ..." + systemctl stop remsound-relay.service 2>/dev/null || true + echo "Disabling remsound-relay.service ..." + systemctl disable remsound-relay.service 2>/dev/null || true fi -if [[ -f /etc/systemd/system/remsound-relay.service ]]; then - echo "Removing /etc/systemd/system/remsound-relay.service ..." - rm -f /etc/systemd/system/remsound-relay.service -fi +for f in \ + /etc/systemd/system/remsound-relay.service \ + /etc/systemd/system/remsound-relay-update.service \ + /etc/systemd/system/remsound-relay-update.timer \ + /usr/local/sbin/remsound-relay.py \ + /usr/local/sbin/remsound-relay-update.sh +do + if [[ -f "$f" ]]; then + echo "Removing $f ..." + rm -f "$f" + fi +done -if [[ -f /usr/local/sbin/remsound-relay.py ]]; then - echo "Removing /usr/local/sbin/remsound-relay.py ..." - rm -f /usr/local/sbin/remsound-relay.py +if [[ -d /etc/remsound-relay ]]; then + echo "Removing /etc/remsound-relay/ (version stamp + backup) ..." + rm -rf /etc/remsound-relay fi systemctl daemon-reload echo echo "Uninstall complete." -echo "Note: /var/log/remsound-relay.log is left in place — delete it yourself if you don't want it." +echo "Note: log files left in place — delete them yourself if you don't want them:" +echo " /var/log/remsound-relay.log" +echo " /var/log/remsound-relay-update.log" echo "Note: any router port-forward you added for UDP 47830 is unchanged — remove that yourself if you no longer need it."