From 96ac630b2923918fc24fc6729dedff812d865091 Mon Sep 17 00:00:00 2001 From: Konano Date: Fri, 29 Aug 2025 19:27:26 +0800 Subject: [PATCH] fix: check if nginx is already installed before prompting for installation --- configure_priv.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure_priv.sh b/configure_priv.sh index 6dc1406..5b4bd7a 100755 --- a/configure_priv.sh +++ b/configure_priv.sh @@ -315,6 +315,9 @@ configure_nginx() { echo "deb-src [signed-by=/usr/share/keyrings/nginx.gpg] https://nginx.org/packages/ubuntu/ $(lsb_release -cs) nginx" | sudo tee -a /etc/apt/sources.list.d/nginx.list >/dev/null fi if confirm_action "要安装 nginx 吗?" "Y"; then + if command_exists nginx && ! confirm_action "检测到旧版 nginx 的存在 ($(nginx -v 2>&1)),是否继续安装?" "N"; then + return + fi sudo apt-get update sudo apt-get install nginx -y echo "nginx 版本: $(nginx -v 2>&1)"