From 1bfa2383c1f18fecda7290859f2cc79dae091b0f Mon Sep 17 00:00:00 2001 From: lxh2875931338 Date: Tue, 28 Jul 2026 20:21:01 +0800 Subject: [PATCH] =?UTF-8?q?docker=E8=84=9A=E6=9C=AC=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 61 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/deploy.sh b/deploy.sh index b3c2971..f597c6f 100644 --- a/deploy.sh +++ b/deploy.sh @@ -14,14 +14,26 @@ set -e -# ---------- 颜色输出 ---------- -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -CYAN='\033[0;36m' -MAGENTA='\033[0;35m' -NC='\033[0m' +# ---------- 颜色检测 ---------- +if [ -t 1 ]; then + # 交互式终端,启用颜色 + RED='\033[0;31m' + GREEN='\033[0;32m' + YELLOW='\033[1;33m' + BLUE='\033[0;34m' + CYAN='\033[0;36m' + MAGENTA='\033[0;35m' + NC='\033[0m' +else + # 非交互式终端(如管道),禁用颜色 + RED='' + GREEN='' + YELLOW='' + BLUE='' + CYAN='' + MAGENTA='' + NC='' +fi # ---------- 配置 ---------- REPO_URL="https://git.whitetop.xyz/lxh2875931338/frpc-console.git" @@ -226,7 +238,7 @@ print_environment_summary() { if [ "$HAS_GIT" = true ]; then echo -e " git ✅ 已安装 ($(git --version | awk '{print $3}'))" else - echo -e " git ❌ 未安装 (将自动安装)" + echo " git ❌ 未安装 (将自动安装)" fi if [ "$HAS_CURL" = true ]; then echo " curl ✅ 已安装" @@ -267,10 +279,11 @@ print_environment_summary() { echo "" echo " ${CYAN}容器状态:${NC}" if [ "$CONTAINER_RUNNING" = true ]; then - echo -e " frpc-console ✅ 运行中" + echo -e " frpc-console ✅ 运行中 (将停止并重建)" else - echo -e " frpc-console ⏸️ 已存在但未运行" + echo -e " frpc-console ⏸️ 已停止 (将重建)" fi + echo -e " ${YELLOW}数据目录中的数据库文件将被保留${NC}" fi echo "" @@ -335,12 +348,17 @@ confirm_deploy() { echo -e "${GREEN}▶ 已启用 --yes,自动确认${NC}" return 0 fi + echo -e -n "${CYAN}确认执行? 输入 Y 继续,输入 n 自定义配置 [Y/n]: ${NC}" - # 强制从 /dev/tty 读取,而不是继承 stdin read -r CONFIRM /dev/null || true - parse_args "$@" check_root # ---- 环境检测 ---- - print_step "正在检测环境..." + print_step "检测环境..." detect_os detect_arch check_tools