docker脚本部分逻辑更新
This commit is contained in:
@@ -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/tty
|
||||
|
||||
case $CONFIRM in
|
||||
n|N) return 1 ;;
|
||||
*) return 0 ;;
|
||||
n|N)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -383,7 +401,15 @@ do_deploy() {
|
||||
|
||||
case $OS in
|
||||
opensuse*|suse*|opensuse-tumbleweed|opensuse-slowroll|opensuse-leap)
|
||||
zypper install -y $pkgs-core
|
||||
# OpenSUSE 使用 git-core 而非 git
|
||||
if [ "$NEED_INSTALL_GIT" = true ]; then
|
||||
zypper install -y git-core
|
||||
# 移除 git 避免重复安装
|
||||
pkgs=$(echo "$pkgs" | sed 's/ git / /g' | sed 's/git //g' | sed 's/ git$//')
|
||||
fi
|
||||
if [ -n "$pkgs" ]; then
|
||||
zypper install -y $pkgs
|
||||
fi
|
||||
;;
|
||||
ubuntu|debian|linuxmint)
|
||||
apt update -qq && apt install -y $pkgs
|
||||
@@ -574,17 +600,14 @@ do_deploy() {
|
||||
print_title
|
||||
}
|
||||
|
||||
# ---------- 主流程 ----------
|
||||
# ---------- 主流程 ----------
|
||||
main() {
|
||||
# 清屏,让输出从头开始
|
||||
clear 2>/dev/null || true
|
||||
|
||||
parse_args "$@"
|
||||
check_root
|
||||
|
||||
# ---- 环境检测 ----
|
||||
print_step "正在检测环境..."
|
||||
print_step "检测环境..."
|
||||
detect_os
|
||||
detect_arch
|
||||
check_tools
|
||||
|
||||
Reference in New Issue
Block a user