feat: automate HAProxy cleanup and Caddy restore during sing-box uninstallation
Main / build (push) Waiting to run

This commit is contained in:
2026-07-08 01:55:33 +08:00
parent 3f383af8d4
commit 81206be8a4
+18
View File
@@ -850,6 +850,24 @@ uninstall() {
else
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
systemctl stop haproxy >/dev/null 2>&1
systemctl disable haproxy >/dev/null 2>&1
if [[ $(type -P apt-get) ]]; then
apt-get purge -y haproxy >/dev/null 2>&1
apt-get autoremove -y >/dev/null 2>&1
elif [[ $(type -P dnf) ]]; then
dnf remove -y haproxy >/dev/null 2>&1
elif [[ $(type -P yum) ]]; then
yum remove -y haproxy >/dev/null 2>&1
fi
fi
# If Caddy is NOT being uninstalled (REPLY != '2'), we must restore Caddy back to port 443!
if [[ $REPLY != '2' ]]; then
restore_caddy_default
fi
manage stop &>/dev/null
manage disable &>/dev/null
rm -rf $is_core_dir $is_log_dir $is_sh_bin ${is_sh_bin/$is_core/sb}