-
Notifications
You must be signed in to change notification settings - Fork 2
添加MoFox Liunx部署脚本 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Linux
Are you sure you want to change the base?
Conversation
Reviewer's GuideIntroduces a pure-shell MoFox deployment workflow by adding a comprehensive installer script that handles environment detection, dependency management, cloning, configuration, and setup of a CLI launcher. Sequence diagram for MoFox deployment workflowsequenceDiagram
actor User
participant Script
participant System
participant GitHub
User->>Script: Run MoFox-install.sh
Script->>System: Check root/sudo, detect OS & package manager
Script->>User: Prompt for GitHub proxy selection
User->>Script: Select proxy
Script->>System: Install dependencies (git, python3, screen, etc.)
Script->>GitHub: Download uv installer script
Script->>System: Install uv
Script->>GitHub: Clone MoFox_Bot repository
Script->>System: Install Python dependencies via uv
Script->>GitHub: Download CLI launcher (mofox)
Script->>System: Configure launcher and write path.conf
Script->>User: Print completion message and usage instructions
User->>System: Edit config files and launch MoFox
Class diagram for main shell script functions and responsibilitiesclassDiagram
class MoFoxInstallScript {
+get_script_dir()
+command_exists(cmd)
+info(msg)
+ok(msg)
+warn(msg)
+err(msg)
+print_title(title)
+download_with_retry(url, output)
+select_github_proxy()
+check_sudo()
+detect_system()
+detect_package_manager()
+install_package(package)
+install_system_dependencies()
+install_uv_environment()
+clone_MoFox_Bot()
+install_python_dependencies()
+download_script()
+show_text()
+main()
}
MoFoxInstallScript : manages deployment workflow
MoFoxInstallScript : handles user interaction, environment detection, dependency installation, project setup, and finalization
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Consider adding a non-interactive/unattended flag or environment variables to bypass the interactive prompts (select and read) for automated or CI-driven deployments.
- Wrap all variable expansions (especially when concatenating URLs or file paths, e.g. "$GITHUB_PROXY" plus path) in quotes to avoid word-splitting or globbing issues.
- The script is quite monolithic—splitting it into smaller, focused scripts or sourced modules (e.g. system detection, dependency installation, cloning) would improve readability and maintainability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a non-interactive/unattended flag or environment variables to bypass the interactive prompts (select and read) for automated or CI-driven deployments.
- Wrap all variable expansions (especially when concatenating URLs or file paths, e.g. "$GITHUB_PROXY" plus path) in quotes to avoid word-splitting or globbing issues.
- The script is quite monolithic—splitting it into smaller, focused scripts or sourced modules (e.g. system detection, dependency installation, cloning) would improve readability and maintainability.
## Individual Comments
### Comment 1
<location> `MoFox-install.sh:264-265` </location>
<code_context>
+ apk)
+ $SUDO apk add gcc musl-dev linux-headers "$package" #安装包
+ ;;
+ brew)
+ $SUDO install "$package" #安装包
+ ;;
+ *)
</code_context>
<issue_to_address>
**issue (bug_risk):** The Homebrew install command is incorrect.
Replace `$SUDO install "$package"` with `$SUDO brew install "$package"` to ensure proper installation via Homebrew and avoid failures.
</issue_to_address>
### Comment 2
<location> `MoFox-install.sh:459-460` </location>
<code_context>
+ ok "mofox 脚本已下载到 $TARGET_FILE"
+
+ # 软链到 /usr/local/bin 方便全局调用
+ $SUDO ln -sf "$TARGET_FILE" /usr/local/bin/mofox
+
+ # 直接写 path.conf 到用户目录,不用初始化
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Symlinking to /usr/local/bin may fail without sufficient permissions.
Check for write access to /usr/local/bin before creating the symlink, and provide a fallback to ~/.local/bin if permissions are insufficient.
```suggestion
# 检查 /usr/local/bin 是否可写,否则软链到 ~/.local/bin
if [ -w /usr/local/bin ] || [ "$(id -u)" -eq 0 ]; then
$SUDO ln -sf "$TARGET_FILE" /usr/local/bin/mofox
ok "已创建软链到 /usr/local/bin/mofox"
else
# fallback to ~/.local/bin
local LOCAL_BIN_DIR="$HOME/.local/bin"
mkdir -p "$LOCAL_BIN_DIR"
ln -sf "$TARGET_FILE" "$LOCAL_BIN_DIR/mofox"
ok "无权限写入 /usr/local/bin,已创建软链到 $LOCAL_BIN_DIR/mofox"
ok "请确保 $LOCAL_BIN_DIR 已加入 PATH"
fi
```
</issue_to_address>
### Comment 3
<location> `MoFox-install.sh:393` </location>
<code_context>
+ # 配置 uv 镜像源
+ export UV_INDEX_URL="https://mirrors.ustc.edu.cn/pypi/simple/"
+ mkdir -p ~/.cache/uv
+ chown -R "$(whoami):$(whoami)" ~/.cache/uv
+
+ # 安装 MoFox_Bot 依赖
</code_context>
<issue_to_address>
**suggestion:** Using chown with $(whoami):$(whoami) may not work on all systems.
Some systems lack a group matching the username, which can cause chown to fail. Use `$(id -u):$(id -g)` or handle chown errors appropriately.
```suggestion
chown -R "$(id -u):$(id -g)" ~/.cache/uv || warn "chown ~/.cache/uv 失败, 请检查权限"
```
</issue_to_address>
### Comment 4
<location> `MoFox-install.sh:439-440` </location>
<code_context>
+ warn "未找到 template/model_config_template.toml"
+ fi
+
+ if [[ -f "template/bot_config_template.toml" ]]; then
+ cp "template/bot_config_template.toml" "config/bot_config.toml"
+ ok "已复制 bot_config_template.toml"
+ else
</code_context>
<issue_to_address>
**suggestion:** The copied config file name does not match the referenced file in the completion message.
The instructions should reference 'bot_config.toml' instead of 'bot_config_template.toml' to avoid user confusion.
```suggestion
cp "template/bot_config_template.toml" "config/bot_config.toml"
ok "已复制 bot_config.toml"
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
|
其实我建议是把自己的脚本放在独立仓库 |
|
onekey-plus仓库我们都不常看,导致我现在才看到 |
好的 我这个周六日就更新一次(添加一些参数支持和优化代码质量) 以后我会2个星期保底维护一次的 因为我只是一名学生(最近在准备期中考试现在考完了) 脚本本身就是在独立的仓库里面https://github.com/Astriora/Antlia |
维护人员 您好
我为您的项目提供了部署脚本
该脚本是使用纯shell写的 包括以下几个部署流程
定义全局变量
检查sudo和是否是root用户
检测软件包管理器
选择GitHub克隆源
安装依赖
使用我维护的脚本安装uv支持GitHub代理
克隆项目
同步依赖
复制配置文件
下载启动脚本初始化
打印部署完成的输出脚本结束
启动脚本使用screen会话管理使用简单 支持很多Linux发行版 除(termux安装proot容器外 因为proot的环境太特殊了导致mofox后台启动后 找不到screen会话 这个是没有办法的 安卓的环境太特殊了)
提供简单的菜单 前台后台启动 停止附加screen会话 更新mofox使用git pull和同步uv依赖 退出脚本
该脚本已经过测试
archlinux-20251025-testlog.txt
ubuntu-20251025-testlog.txt
测试均正常 代码透明 无恶意代码
我会给脚本提供提供维护更新
望通过谢谢
使用命令您可以使用
bash <(curl -sSL https://raw.githubusercontent.com/Astriora/Antlia/refs/heads/main/Script/MoFox-Studio/MoFox-install.sh)来使用这个脚本
您可以把脚本的raw链接修改为您的仓库的链接
期待您的反馈,谢谢!
Summary by Sourcery
Automate MoFox_Bot deployment and lifecycle management using pure shell scripts with cross-distro support and GitHub proxy selection.
New Features: