fix: check if nginx is already installed before prompting for installation
This commit is contained in:
parent
df95e30c58
commit
96ac630b29
@ -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
|
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
|
fi
|
||||||
if confirm_action "要安装 nginx 吗?" "Y"; then
|
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 update
|
||||||
sudo apt-get install nginx -y
|
sudo apt-get install nginx -y
|
||||||
echo "nginx 版本: $(nginx -v 2>&1)"
|
echo "nginx 版本: $(nginx -v 2>&1)"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user