forked from hgmzhn/manga-translator-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacOS_3_检查更新并启动.sh
More file actions
executable file
·73 lines (61 loc) · 1.91 KB
/
Copy pathmacOS_3_检查更新并启动.sh
File metadata and controls
executable file
·73 lines (61 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# ==================== macOS 检查更新并启动 ====================
# 适用于 Apple Silicon Mac
# 对应 Windows 的「步骤3-检查更新并启动.bat」
# =====================================================================
# 使用脚本所在目录作为工作目录
cd "$(dirname "$0")" || { echo "Error: Failed to change directory"; exit 1; }
SCRIPT_DIR="$(pwd)"
# 配置
CONDA_ENV_NAME="manga-env"
MINICONDA_DIR="$SCRIPT_DIR/Miniforge3"
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo "=============================================="
echo " Manga Translator UI - 检查更新并启动"
echo "=============================================="
echo ""
# 查找并初始化 Conda
init_conda() {
if [ -f "$MINICONDA_DIR/bin/conda" ]; then
export PATH="$MINICONDA_DIR/bin:$PATH"
eval "$("$MINICONDA_DIR/bin/conda" shell.bash hook)"
return 0
fi
if command -v conda &> /dev/null; then
eval "$(conda shell.bash hook)"
return 0
fi
return 1
}
# 初始化 Conda
if ! init_conda; then
echo -e "${RED}[错误] 未找到 Conda${NC}"
echo " 请先运行 ./macOS_1_首次安装.sh 安装"
exit 1
fi
# 激活环境
if ! conda activate "$CONDA_ENV_NAME" 2>/dev/null; then
echo -e "${RED}[错误] 未找到环境: $CONDA_ENV_NAME${NC}"
echo " 请先运行 ./macOS_1_首次安装.sh 安装"
exit 1
fi
echo -e "${GREEN}[OK] 已激活环境: $CONDA_ENV_NAME${NC}"
# 检查更新
echo ""
echo -e "${BLUE}[*] 检查版本更新...${NC}"
if [ -f "packaging/check_version.py" ]; then
python packaging/check_version.py --brief 2>/dev/null || true
else
echo -e "${YELLOW}[提示] 版本检查脚本不存在,跳过${NC}"
fi
# 启动 Qt 界面
echo ""
echo "========================================"
echo -e "${GREEN}[*] 启动应用程序...${NC}"
echo ""
python desktop_qt_ui/main.py