From fa34c74937e073d855764900c6ae77fe66431348 Mon Sep 17 00:00:00 2001 From: svefnz Date: Wed, 8 Jul 2026 13:26:44 +0800 Subject: [PATCH] fix: ensure HAProxy is completely removed and Caddy is restored during uninstall --- src/core.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core.sh b/src/core.sh index 31dd05e..a526c1c 100644 --- a/src/core.sh +++ b/src/core.sh @@ -894,7 +894,7 @@ uninstall() { ask string y "是否卸载 ${is_core_name}? [y]:" fi # Clean up HAProxy and restore Caddy before removing files - if systemctl is-active --quiet haproxy >/dev/null 2>&1; then + if [[ $(type -P haproxy) || -d /etc/haproxy ]]; then systemctl stop haproxy >/dev/null 2>&1 systemctl disable haproxy >/dev/null 2>&1 if [[ $(type -P apt-get) ]]; then @@ -905,6 +905,7 @@ uninstall() { elif [[ $(type -P yum) ]]; then yum remove -y haproxy >/dev/null 2>&1 fi + rm -rf /etc/haproxy fi # If Caddy is NOT being uninstalled (REPLY != '2'), we must restore Caddy back to port 443! if [[ $REPLY != '2' ]]; then