-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·63 lines (52 loc) · 1.92 KB
/
install.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1.92 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
#!/bin/bash
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "==> 检查 Python 3"
command -v python3 >/dev/null 2>&1 || { echo "未找到 python3,请先安装 Python 3"; exit 1; }
echo "==> 创建虚拟环境"
if [ ! -d "$REPO_DIR/.venv" ]; then
python3 -m venv "$REPO_DIR/.venv"
fi
echo "==> 安装依赖"
"$REPO_DIR/.venv/bin/pip" install -U pip >/dev/null
"$REPO_DIR/.venv/bin/pip" install -r "$REPO_DIR/requirements.txt"
echo "==> 安装 AI 运行时"
bash "$REPO_DIR/install_ai_runtimes.sh"
echo "==> 准备脚本权限"
chmod +x "$REPO_DIR/run_role_bot.sh" \
"$REPO_DIR/run_group_bot.sh" \
"$REPO_DIR/install.sh" \
"$REPO_DIR/install_ai_runtimes.sh" \
"$REPO_DIR/configure_ai_runtimes.sh" \
"$REPO_DIR/configure.sh" \
"$REPO_DIR/apply_stack.sh" \
"$REPO_DIR/bootstrap_bot_stack.sh" \
"$REPO_DIR/health_check.sh" \
"$REPO_DIR/scripts/shared-memory-write.sh"
echo "==> 初始化本地目录"
mkdir -p "$REPO_DIR/shared-memory" "$REPO_DIR/generated"
touch "$REPO_DIR/shared-memory/MEMORY.md"
if [ ! -f "$REPO_DIR/bot_stack.bootstrap.toml" ]; then
cp "$REPO_DIR/bot_stack.bootstrap.toml.example" "$REPO_DIR/bot_stack.bootstrap.toml"
echo "==> 已创建 bot_stack.bootstrap.toml"
fi
if [ ! -f "$REPO_DIR/.bot_tokens.env.example" ]; then
cat > "$REPO_DIR/.bot_tokens.env.example" <<'EOF'
export TG_OPENCLAW_GROUP_TOKEN=""
export TG_GEMINI_GROUP_TOKEN=""
export TG_CODEX_GROUP_TOKEN=""
export TG_OPENCLAW_PRIVATE_TOKEN=""
export TG_GEMINI_PRIVATE_TOKEN=""
export TG_CODEX_PRIVATE_TOKEN=""
EOF
fi
if [ ! -f "$REPO_DIR/.bot_tokens.env" ]; then
cp "$REPO_DIR/.bot_tokens.env.example" "$REPO_DIR/.bot_tokens.env"
echo "==> 已创建 .bot_tokens.env"
fi
echo
echo "安装完成。下一步:"
echo "1) bash ./configure_ai_runtimes.sh"
echo "2) bash ./configure.sh"
echo "3) 把 bot token 写入 .bot_tokens.env"
echo "4) bash ./apply_stack.sh"