feat: automate HAProxy cleanup and Caddy restore during sing-box uninstallation
Main / build (push) Waiting to run
Main / build (push) Waiting to run
This commit is contained in:
+18
@@ -850,6 +850,24 @@ uninstall() {
|
|||||||
else
|
else
|
||||||
ask string y "是否卸载 ${is_core_name}? [y]:"
|
ask string y "是否卸载 ${is_core_name}? [y]:"
|
||||||
fi
|
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 stop &>/dev/null
|
||||||
manage disable &>/dev/null
|
manage disable &>/dev/null
|
||||||
rm -rf $is_core_dir $is_log_dir $is_sh_bin ${is_sh_bin/$is_core/sb}
|
rm -rf $is_core_dir $is_log_dir $is_sh_bin ${is_sh_bin/$is_core/sb}
|
||||||
|
|||||||
Reference in New Issue
Block a user