更新包名
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
## Moltbot (原 ClawdBot) 一键安装与管理脚本
|
## openclaw (原 ClawdBot) 一键安装与管理脚本
|
||||||
|
|
||||||
### linux 脚本
|
### linux 脚本
|
||||||
```
|
```
|
||||||
bash <(curl -sSL https://raw.githubusercontent.com/sky22333/shell/main/moltbot/install.sh)
|
bash <(curl -sSL https://raw.githubusercontent.com/sky22333/shell/main/openclaw/install.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
### windows 脚本
|
### windows 脚本
|
||||||
直接下载使用编译好的二进制文件:https://github.com/sky22333/shell/raw/main/moltbot/installer/installer.exe
|
直接下载使用编译好的二进制文件:https://github.com/sky22333/shell/raw/main/openclaw/installer/installer.exe
|
||||||
|
|
||||||
下载后使用管理员权限运行
|
下载后使用管理员权限运行
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ set GIT_PROXY=https://g.blfrp.cn/
|
|||||||
installer.exe
|
installer.exe
|
||||||
```
|
```
|
||||||
|
|
||||||
如果你选择跳过设置TG机器人,启动后可以访问ClawdBot内置的Web面板进行对话:`http://127.0.0.1:18789`
|
如果你选择跳过设置TG机器人,启动后可以访问OpenClaw内置的Web面板进行对话:`http://127.0.0.1:18789`
|
||||||
|
|
||||||
### 构建(可选)
|
### 构建(可选)
|
||||||
如果你不放心预编译的二进制文件,可以自己构建。
|
如果你不放心预编译的二进制文件,可以自己构建。
|
||||||
@@ -26,7 +26,7 @@ installer.exe
|
|||||||
|
|
||||||
2:进入项目目录
|
2:进入项目目录
|
||||||
```
|
```
|
||||||
cd moltbot/installer
|
cd openclaw/installer
|
||||||
```
|
```
|
||||||
3:安装依赖
|
3:安装依赖
|
||||||
```
|
```
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Moltbot (原 ClawdBot) 一键安装与管理脚本
|
# OpenClaw 一键安装与管理脚本
|
||||||
# 兼容 Debian / Ubuntu
|
# 兼容 Debian / Ubuntu
|
||||||
# 官方文档: https://docs.molt.bot
|
# 官方文档: https://docs.openclaw.app
|
||||||
|
|
||||||
# 颜色定义
|
# 颜色定义
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
@@ -13,10 +13,10 @@ CYAN='\033[0;36m'
|
|||||||
PLAIN='\033[0m'
|
PLAIN='\033[0m'
|
||||||
|
|
||||||
# 配置文件路径
|
# 配置文件路径
|
||||||
# Moltbot 依然使用 .clawdbot 目录以保持兼容性
|
# OpenClaw 使用 .openclaw 目录
|
||||||
CONFIG_DIR="${HOME}/.clawdbot"
|
CONFIG_DIR="${HOME}/.openclaw"
|
||||||
CONFIG_FILE="${CONFIG_DIR}/clawdbot.json"
|
CONFIG_FILE="${CONFIG_DIR}/openclaw.json"
|
||||||
SERVICE_FILE="/etc/systemd/system/moltbot.service"
|
SERVICE_FILE="/etc/systemd/system/openclaw.service"
|
||||||
|
|
||||||
check_root() {
|
check_root() {
|
||||||
if [ $EUID -ne 0 ]; then
|
if [ $EUID -ne 0 ]; then
|
||||||
@@ -62,10 +62,10 @@ install_nodejs() {
|
|||||||
log_info "Node.js 已安装且版本符合要求 (${NODE_VERSION_FULL}),无需重复安装。"
|
log_info "Node.js 已安装且版本符合要求 (${NODE_VERSION_FULL}),无需重复安装。"
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
log_warn "检测到旧版本 Node.js (${NODE_VERSION_FULL}),Moltbot 需要 Node.js 22+"
|
log_warn "检测到旧版本 Node.js (${NODE_VERSION_FULL}),OpenClaw 需要 Node.js 22+"
|
||||||
read -p "是否升级 Node.js 到 22.x?(这将覆盖现有版本) [y/n]: " upgrade_node
|
read -p "是否升级 Node.js 到 22.x?(这将覆盖现有版本) [y/n]: " upgrade_node
|
||||||
if [ "$upgrade_node" != "y" ]; then
|
if [ "$upgrade_node" != "y" ]; then
|
||||||
log_error "已取消 Node.js 升级。Moltbot 可能无法正常运行。"
|
log_error "已取消 Node.js 升级。OpenClaw 可能无法正常运行。"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -86,13 +86,13 @@ install_nodejs() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 安装 Moltbot
|
# 安装 OpenClaw
|
||||||
install_moltbot_core() {
|
install_openclaw_core() {
|
||||||
log_info "正在安装 Moltbot..."
|
log_info "正在安装 OpenClaw..."
|
||||||
|
|
||||||
if command -v clawdbot >/dev/null 2>&1; then
|
if command -v openclaw >/dev/null 2>&1; then
|
||||||
CURRENT_VERSION=$(clawdbot --version)
|
CURRENT_VERSION=$(openclaw --version)
|
||||||
log_warn "ClawdBot (Moltbot) 已安装 (版本: ${CURRENT_VERSION})"
|
log_warn "OpenClaw 已安装 (版本: ${CURRENT_VERSION})"
|
||||||
read -p "是否强制重新安装/更新?[y/n]: " force_install
|
read -p "是否强制重新安装/更新?[y/n]: " force_install
|
||||||
if [ "$force_install" != "y" ]; then
|
if [ "$force_install" != "y" ]; then
|
||||||
log_info "跳过安装步骤。"
|
log_info "跳过安装步骤。"
|
||||||
@@ -100,19 +100,19 @@ install_moltbot_core() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
npm install -g clawdbot@latest
|
npm install -g openclaw@latest
|
||||||
|
|
||||||
if command -v clawdbot >/dev/null 2>&1; then
|
if command -v openclaw >/dev/null 2>&1; then
|
||||||
VERSION=$(clawdbot --version)
|
VERSION=$(openclaw --version)
|
||||||
log_info "ClawdBot 安装成功,版本: ${VERSION}"
|
log_info "OpenClaw 安装成功,版本: ${VERSION}"
|
||||||
else
|
else
|
||||||
log_error "ClawdBot 安装失败,请检查 npm 权限或网络!"
|
log_error "OpenClaw 安装失败,请检查 npm 权限或网络!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 配置 Moltbot
|
# 配置 OpenClaw
|
||||||
configure_moltbot() {
|
configure_openclaw() {
|
||||||
if [ -f "${CONFIG_FILE}" ]; then
|
if [ -f "${CONFIG_FILE}" ]; then
|
||||||
log_warn "检测到已存在配置文件: ${CONFIG_FILE}"
|
log_warn "检测到已存在配置文件: ${CONFIG_FILE}"
|
||||||
read -p "是否覆盖现有配置?[y/n]: " overwrite_config
|
read -p "是否覆盖现有配置?[y/n]: " overwrite_config
|
||||||
@@ -122,7 +122,7 @@ configure_moltbot() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_info "开始配置 Moltbot..."
|
log_info "开始配置 OpenClaw..."
|
||||||
|
|
||||||
mkdir -p "${CONFIG_DIR}"
|
mkdir -p "${CONFIG_DIR}"
|
||||||
|
|
||||||
@@ -249,13 +249,13 @@ setup_systemd() {
|
|||||||
|
|
||||||
cat > "${SERVICE_FILE}" <<EOF
|
cat > "${SERVICE_FILE}" <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Moltbot Gateway
|
Description=OpenClaw Gateway
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
ExecStart=$(command -v clawdbot) gateway --verbose
|
ExecStart=$(command -v openclaw) gateway --verbose
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
Environment=HOME=${HOME}
|
Environment=HOME=${HOME}
|
||||||
@@ -265,8 +265,8 @@ WantedBy=multi-user.target
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable moltbot
|
systemctl enable openclaw
|
||||||
systemctl restart moltbot
|
systemctl restart openclaw
|
||||||
|
|
||||||
log_info "服务已启动并设置开机自启!"
|
log_info "服务已启动并设置开机自启!"
|
||||||
}
|
}
|
||||||
@@ -276,46 +276,47 @@ install() {
|
|||||||
check_root
|
check_root
|
||||||
check_sys
|
check_sys
|
||||||
install_nodejs
|
install_nodejs
|
||||||
install_moltbot_core
|
install_openclaw_core
|
||||||
configure_moltbot
|
configure_openclaw
|
||||||
setup_systemd
|
setup_systemd
|
||||||
|
|
||||||
echo -e "${GREEN}=============================================${PLAIN}"
|
echo -e "${GREEN}=============================================${PLAIN}"
|
||||||
echo -e "${GREEN} Moltbot 安装配置完成!${PLAIN}"
|
echo -e "${GREEN} OpenClaw 安装配置完成!${PLAIN}"
|
||||||
echo -e "${GREEN}=============================================${PLAIN}"
|
echo -e "${GREEN}=============================================${PLAIN}"
|
||||||
echo -e "请等待Moltbot初始化完成(约1分钟),然后使用Telegram向您的Bot发送消息开始使用。"
|
echo -e "请等待OpenClaw初始化完成(约1分钟),然后使用Telegram向您的Bot发送消息开始使用。"
|
||||||
echo -e "${GREEN}=============================================${PLAIN}"
|
echo -e "${GREEN}=============================================${PLAIN}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 卸载流程
|
# 卸载流程
|
||||||
uninstall() {
|
uninstall() {
|
||||||
check_root
|
check_root
|
||||||
read -p "确定要卸载 Moltbot 吗?配置文件也将被删除 [y/n]: " confirm
|
read -p "确定要卸载 OpenClaw 吗?配置文件也将被删除 [y/n]: " confirm
|
||||||
if [ "$confirm" != "y" ]; then
|
if [ "$confirm" != "y" ]; then
|
||||||
echo "已取消。"
|
echo "已取消。"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl stop moltbot
|
systemctl stop openclaw
|
||||||
systemctl disable moltbot
|
systemctl disable openclaw
|
||||||
rm -f "${SERVICE_FILE}"
|
rm -f "${SERVICE_FILE}"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
npm uninstall -g clawdbot
|
npm uninstall -g openclaw
|
||||||
npm uninstall -g moltbot # 尝试卸载旧包
|
npm uninstall -g moltbot # 尝试卸载旧包
|
||||||
|
npm uninstall -g clawdbot # 尝试卸载旧包
|
||||||
rm -rf "${CONFIG_DIR}"
|
rm -rf "${CONFIG_DIR}"
|
||||||
|
|
||||||
log_info "Moltbot (ClawdBot) 已卸载。"
|
log_info "OpenClaw 已卸载。"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 修改配置 (重新运行配置向导)
|
# 修改配置 (重新运行配置向导)
|
||||||
modify_config() {
|
modify_config() {
|
||||||
echo -e "${YELLOW}注意:此操作将重新生成配置文件,并且重启服务。${PLAIN}"
|
echo -e "${YELLOW}注意:此操作将重新生成配置文件,并且重启服务。${PLAIN}"
|
||||||
configure_moltbot
|
configure_openclaw
|
||||||
log_info "正在重启服务以应用更改..."
|
log_info "正在重启服务以应用更改..."
|
||||||
systemctl restart moltbot
|
systemctl restart openclaw
|
||||||
sleep 1
|
sleep 1
|
||||||
if systemctl is-active --quiet moltbot; then
|
if systemctl is-active --quiet openclaw; then
|
||||||
log_info "服务已重启并正常运行。"
|
log_info "服务已重启并正常运行。"
|
||||||
else
|
else
|
||||||
log_error "服务启动失败!请查看日志。"
|
log_error "服务启动失败!请查看日志。"
|
||||||
@@ -325,16 +326,16 @@ modify_config() {
|
|||||||
# 菜单
|
# 菜单
|
||||||
show_menu() {
|
show_menu() {
|
||||||
clear
|
clear
|
||||||
echo -e "${CYAN}Moltbot(Clawdbot)管理脚本${PLAIN}"
|
echo -e "${CYAN}OpenClaw 管理脚本${PLAIN}"
|
||||||
echo -e "${CYAN}------------------------${PLAIN}"
|
echo -e "${CYAN}------------------------${PLAIN}"
|
||||||
echo -e "1. 安装并配置 Moltbot"
|
echo -e "1. 安装并配置 OpenClaw"
|
||||||
echo -e "2. 启动服务"
|
echo -e "2. 启动服务"
|
||||||
echo -e "3. 停止服务"
|
echo -e "3. 停止服务"
|
||||||
echo -e "4. 重启服务"
|
echo -e "4. 重启服务"
|
||||||
echo -e "5. 查看运行状态"
|
echo -e "5. 查看运行状态"
|
||||||
echo -e "6. 查看实时日志"
|
echo -e "6. 查看实时日志"
|
||||||
echo -e "7. 修改配置文件"
|
echo -e "7. 修改配置文件"
|
||||||
echo -e "8. 卸载 Moltbot"
|
echo -e "8. 卸载 OpenClaw"
|
||||||
echo -e "9. 运行doctor自检"
|
echo -e "9. 运行doctor自检"
|
||||||
echo -e "0. 退出脚本"
|
echo -e "0. 退出脚本"
|
||||||
echo -e "${CYAN}------------------------${PLAIN}"
|
echo -e "${CYAN}------------------------${PLAIN}"
|
||||||
@@ -342,14 +343,14 @@ show_menu() {
|
|||||||
|
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
1) install ;;
|
1) install ;;
|
||||||
2) systemctl start moltbot && log_info "服务已启动" ;;
|
2) systemctl start openclaw && log_info "服务已启动" ;;
|
||||||
3) systemctl stop moltbot && log_info "服务已停止" ;;
|
3) systemctl stop openclaw && log_info "服务已停止" ;;
|
||||||
4) systemctl restart moltbot && log_info "服务已重启" ;;
|
4) systemctl restart openclaw && log_info "服务已重启" ;;
|
||||||
5) systemctl status moltbot ;;
|
5) systemctl status openclaw ;;
|
||||||
6) journalctl -u moltbot -f ;;
|
6) journalctl -u openclaw -f ;;
|
||||||
7) modify_config ;;
|
7) modify_config ;;
|
||||||
8) uninstall ;;
|
8) uninstall ;;
|
||||||
9) clawdbot doctor ;;
|
9) openclaw doctor ;;
|
||||||
0) exit 0 ;;
|
0) exit 0 ;;
|
||||||
*) echo -e "${RED}无效选项,请重新输入${PLAIN}" ;;
|
*) echo -e "${RED}无效选项,请重新输入${PLAIN}" ;;
|
||||||
esac
|
esac
|
||||||
@@ -7,11 +7,11 @@ BLUE='\033[0;34m'
|
|||||||
CYAN='\033[0;36m'
|
CYAN='\033[0;36m'
|
||||||
PLAIN='\033[0m'
|
PLAIN='\033[0m'
|
||||||
|
|
||||||
CONFIG_DIR="${HOME}/.clawdbot"
|
CONFIG_DIR="${HOME}/.openclaw"
|
||||||
CONFIG_FILE="${CONFIG_DIR}/clawdbot.json"
|
CONFIG_FILE="${CONFIG_DIR}/openclaw.json"
|
||||||
PLIST_LABEL="com.moltbot.gateway"
|
PLIST_LABEL="com.openclaw.gateway"
|
||||||
PLIST_PATH="${HOME}/Library/LaunchAgents/${PLIST_LABEL}.plist"
|
PLIST_PATH="${HOME}/Library/LaunchAgents/${PLIST_LABEL}.plist"
|
||||||
LOG_DIR="${HOME}/Library/Logs/moltbot"
|
LOG_DIR="${HOME}/Library/Logs/openclaw"
|
||||||
LOG_FILE="${LOG_DIR}/gateway.log"
|
LOG_FILE="${LOG_DIR}/gateway.log"
|
||||||
ERR_FILE="${LOG_DIR}/gateway.error.log"
|
ERR_FILE="${LOG_DIR}/gateway.error.log"
|
||||||
|
|
||||||
@@ -98,28 +98,28 @@ install_git() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_moltbot_core() {
|
install_openclaw_core() {
|
||||||
log_info "正在安装 Moltbot..."
|
log_info "正在安装 OpenClaw..."
|
||||||
if command -v clawdbot >/dev/null 2>&1; then
|
if command -v openclaw >/dev/null 2>&1; then
|
||||||
CURRENT_VERSION=$(clawdbot --version)
|
CURRENT_VERSION=$(openclaw --version)
|
||||||
log_warn "ClawdBot (Moltbot) 已安装 (版本: ${CURRENT_VERSION})"
|
log_warn "OpenClaw 已安装 (版本: ${CURRENT_VERSION})"
|
||||||
read -p "是否强制重新安装/更新?[y/n]: " force_install
|
read -p "是否强制重新安装/更新?[y/n]: " force_install
|
||||||
if [ "$force_install" != "y" ]; then
|
if [ "$force_install" != "y" ]; then
|
||||||
log_info "跳过安装步骤。"
|
log_info "跳过安装步骤。"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
npm install -g clawdbot@latest
|
npm install -g openclaw@latest
|
||||||
if command -v clawdbot >/dev/null 2>&1; then
|
if command -v openclaw >/dev/null 2>&1; then
|
||||||
VERSION=$(clawdbot --version)
|
VERSION=$(openclaw --version)
|
||||||
log_info "ClawdBot 安装成功,版本: ${VERSION}"
|
log_info "OpenClaw 安装成功,版本: ${VERSION}"
|
||||||
else
|
else
|
||||||
log_error "ClawdBot 安装失败,请检查 npm 权限或网络。"
|
log_error "OpenClaw 安装失败,请检查 npm 权限或网络。"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_moltbot() {
|
configure_openclaw() {
|
||||||
if [ -f "${CONFIG_FILE}" ]; then
|
if [ -f "${CONFIG_FILE}" ]; then
|
||||||
log_warn "检测到已存在配置文件: ${CONFIG_FILE}"
|
log_warn "检测到已存在配置文件: ${CONFIG_FILE}"
|
||||||
read -p "是否覆盖现有配置?[y/n]: " overwrite_config
|
read -p "是否覆盖现有配置?[y/n]: " overwrite_config
|
||||||
@@ -128,7 +128,7 @@ configure_moltbot() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
log_info "开始配置 Moltbot..."
|
log_info "开始配置 OpenClaw..."
|
||||||
mkdir -p "${CONFIG_DIR}"
|
mkdir -p "${CONFIG_DIR}"
|
||||||
echo -e "${CYAN}请选择 API 类型:${PLAIN}"
|
echo -e "${CYAN}请选择 API 类型:${PLAIN}"
|
||||||
echo "1. Anthropic 官方 API"
|
echo "1. Anthropic 官方 API"
|
||||||
@@ -342,9 +342,9 @@ setup_launchd() {
|
|||||||
log_info "正在配置 LaunchAgent 服务..."
|
log_info "正在配置 LaunchAgent 服务..."
|
||||||
mkdir -p "$(dirname "${PLIST_PATH}")"
|
mkdir -p "$(dirname "${PLIST_PATH}")"
|
||||||
mkdir -p "${LOG_DIR}"
|
mkdir -p "${LOG_DIR}"
|
||||||
GATEWAY_BIN=$(command -v clawdbot)
|
GATEWAY_BIN=$(command -v openclaw)
|
||||||
if [ -z "${GATEWAY_BIN}" ]; then
|
if [ -z "${GATEWAY_BIN}" ]; then
|
||||||
log_error "未找到 clawdbot 可执行文件。"
|
log_error "未找到 openclaw 可执行文件。"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
NODE_BIN=$(command -v node)
|
NODE_BIN=$(command -v node)
|
||||||
@@ -424,50 +424,51 @@ install() {
|
|||||||
check_macos
|
check_macos
|
||||||
install_git
|
install_git
|
||||||
install_nodejs
|
install_nodejs
|
||||||
install_moltbot_core
|
install_openclaw_core
|
||||||
configure_moltbot
|
configure_openclaw
|
||||||
setup_launchd
|
setup_launchd
|
||||||
echo -e "${GREEN}=============================================${PLAIN}"
|
echo -e "${GREEN}=============================================${PLAIN}"
|
||||||
echo -e "${GREEN} Moltbot 安装配置完成!${PLAIN}"
|
echo -e "${GREEN} OpenClaw 安装配置完成!${PLAIN}"
|
||||||
echo -e "${GREEN}=============================================${PLAIN}"
|
echo -e "${GREEN}=============================================${PLAIN}"
|
||||||
echo -e "请等待Moltbot初始化完成(约1分钟),然后使用Telegram向您的Bot发送消息开始使用。"
|
echo -e "请等待OpenClaw初始化完成(约1分钟),然后使用Telegram向您的Bot发送消息开始使用。"
|
||||||
echo -e "${GREEN}=============================================${PLAIN}"
|
echo -e "${GREEN}=============================================${PLAIN}"
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall() {
|
uninstall() {
|
||||||
check_macos
|
check_macos
|
||||||
read -p "确定要卸载 Moltbot 吗?配置文件也将被删除 [y/n]: " confirm
|
read -p "确定要卸载 OpenClaw 吗?配置文件也将被删除 [y/n]: " confirm
|
||||||
if [ "$confirm" != "y" ]; then
|
if [ "$confirm" != "y" ]; then
|
||||||
echo "已取消。"
|
echo "已取消。"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
service_stop
|
service_stop
|
||||||
rm -f "${PLIST_PATH}"
|
rm -f "${PLIST_PATH}"
|
||||||
|
npm uninstall -g openclaw
|
||||||
npm uninstall -g clawdbot
|
npm uninstall -g clawdbot
|
||||||
npm uninstall -g moltbot
|
npm uninstall -g moltbot
|
||||||
rm -rf "${CONFIG_DIR}"
|
rm -rf "${CONFIG_DIR}"
|
||||||
log_info "Moltbot (ClawdBot) 已卸载。"
|
log_info "OpenClaw 已卸载。"
|
||||||
}
|
}
|
||||||
|
|
||||||
modify_config() {
|
modify_config() {
|
||||||
echo -e "${YELLOW}注意:此操作将重新生成配置文件,并且重启服务。${PLAIN}"
|
echo -e "${YELLOW}注意:此操作将重新生成配置文件,并且重启服务。${PLAIN}"
|
||||||
configure_moltbot
|
configure_openclaw
|
||||||
log_info "正在重启服务以应用更改..."
|
log_info "正在重启服务以应用更改..."
|
||||||
service_restart
|
service_restart
|
||||||
}
|
}
|
||||||
|
|
||||||
show_menu() {
|
show_menu() {
|
||||||
clear
|
clear
|
||||||
echo -e "${CYAN}Moltbot(Clawdbot)管理脚本${PLAIN}"
|
echo -e "${CYAN}OpenClaw 管理脚本${PLAIN}"
|
||||||
echo -e "${CYAN}------------------------${PLAIN}"
|
echo -e "${CYAN}------------------------${PLAIN}"
|
||||||
echo -e "1. 安装并配置 Moltbot"
|
echo -e "1. 安装并配置 OpenClaw"
|
||||||
echo -e "2. 启动服务"
|
echo -e "2. 启动服务"
|
||||||
echo -e "3. 停止服务"
|
echo -e "3. 停止服务"
|
||||||
echo -e "4. 重启服务"
|
echo -e "4. 重启服务"
|
||||||
echo -e "5. 查看运行状态"
|
echo -e "5. 查看运行状态"
|
||||||
echo -e "6. 查看实时日志"
|
echo -e "6. 查看实时日志"
|
||||||
echo -e "7. 修改配置文件"
|
echo -e "7. 修改配置文件"
|
||||||
echo -e "8. 卸载 Moltbot"
|
echo -e "8. 卸载 OpenClaw"
|
||||||
echo -e "9. 运行doctor自检"
|
echo -e "9. 运行doctor自检"
|
||||||
echo -e "0. 退出脚本"
|
echo -e "0. 退出脚本"
|
||||||
echo -e "${CYAN}------------------------${PLAIN}"
|
echo -e "${CYAN}------------------------${PLAIN}"
|
||||||
@@ -481,7 +482,7 @@ show_menu() {
|
|||||||
6) service_logs ;;
|
6) service_logs ;;
|
||||||
7) modify_config ;;
|
7) modify_config ;;
|
||||||
8) uninstall ;;
|
8) uninstall ;;
|
||||||
9) clawdbot doctor ;;
|
9) openclaw doctor ;;
|
||||||
0) exit 0 ;;
|
0) exit 0 ;;
|
||||||
*) echo -e "${RED}无效选项,请重新输入${PLAIN}" ;;
|
*) echo -e "${RED}无效选项,请重新输入${PLAIN}" ;;
|
||||||
esac
|
esac
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
module moltbot-installer
|
module openclaw-installer
|
||||||
|
|
||||||
go 1.25.1
|
go 1.25.1
|
||||||
|
|
||||||
Binary file not shown.
@@ -56,8 +56,8 @@ const nodeMsiSHA256 = "1a5f0cd914386f3be2fbaf03ad9fff808a588ce50d2e155f338fad553
|
|||||||
// SHA256 来源 https://github.com/git-for-windows/git/releases/tag/v2.52.0.windows.1
|
// SHA256 来源 https://github.com/git-for-windows/git/releases/tag/v2.52.0.windows.1
|
||||||
const gitExeSHA256 = "d8de7a3152266c8bb13577eab850ea1df6dccf8c2aa48be5b4a1c58b7190d62c"
|
const gitExeSHA256 = "d8de7a3152266c8bb13577eab850ea1df6dccf8c2aa48be5b4a1c58b7190d62c"
|
||||||
|
|
||||||
// MoltbotConfig 配置结构
|
// OpenclawConfig 配置结构
|
||||||
type MoltbotConfig struct {
|
type OpenclawConfig struct {
|
||||||
Gateway GatewayConfig `json:"gateway"`
|
Gateway GatewayConfig `json:"gateway"`
|
||||||
Env map[string]string `json:"env,omitempty"`
|
Env map[string]string `json:"env,omitempty"`
|
||||||
Agents AgentsConfig `json:"agents"`
|
Agents AgentsConfig `json:"agents"`
|
||||||
@@ -137,8 +137,12 @@ type TelegramConfig struct {
|
|||||||
AllowFrom []string `json:"allowFrom"`
|
AllowFrom []string `json:"allowFrom"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMoltbotPath 获取执行路径
|
// GetOpenclawPath 获取执行路径
|
||||||
func GetMoltbotPath() (string, error) {
|
func GetOpenclawPath() (string, error) {
|
||||||
|
if path, err := exec.LookPath("openclaw"); err == nil {
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
// Legacy fallback
|
||||||
if path, err := exec.LookPath("clawdbot"); err == nil {
|
if path, err := exec.LookPath("clawdbot"); err == nil {
|
||||||
return path, nil
|
return path, nil
|
||||||
}
|
}
|
||||||
@@ -151,17 +155,18 @@ func GetMoltbotPath() (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleClawd := filepath.Join(npmPrefix, "clawdbot.cmd")
|
possibleClawd := filepath.Join(npmPrefix, "openclaw.cmd")
|
||||||
if _, err := os.Stat(possibleClawd); err == nil {
|
if _, err := os.Stat(possibleClawd); err == nil {
|
||||||
return possibleClawd, nil
|
return possibleClawd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Legacy checks
|
||||||
possibleMolt := filepath.Join(npmPrefix, "moltbot.cmd")
|
possibleMolt := filepath.Join(npmPrefix, "moltbot.cmd")
|
||||||
if _, err := os.Stat(possibleMolt); err == nil {
|
if _, err := os.Stat(possibleMolt); err == nil {
|
||||||
return possibleMolt, nil
|
return possibleMolt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", fmt.Errorf("未找到 moltbot 或 clawdbot 可执行文件")
|
return "", fmt.Errorf("未找到 openclaw 可执行文件")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNodePath 获取 Node 路径
|
// GetNodePath 获取 Node 路径
|
||||||
@@ -258,11 +263,11 @@ func SetupGitEnv() error {
|
|||||||
return os.Setenv("PATH", newPath)
|
return os.Setenv("PATH", newPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckMoltbot 检查安装状态
|
// CheckOpenclaw 检查安装状态
|
||||||
func CheckMoltbot() (string, bool) {
|
func CheckOpenclaw() (string, bool) {
|
||||||
SetupNodeEnv()
|
SetupNodeEnv()
|
||||||
|
|
||||||
cmdName, err := GetMoltbotPath()
|
cmdName, err := GetOpenclawPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
@@ -812,11 +817,11 @@ func InstallGit() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// InstallMoltbotNpm 安装包
|
// InstallOpenclawNpm 安装包
|
||||||
func InstallMoltbotNpm(tag string) error {
|
func InstallOpenclawNpm(tag string) error {
|
||||||
SetupNodeEnv()
|
SetupNodeEnv()
|
||||||
|
|
||||||
pkgName := "clawdbot"
|
pkgName := "openclaw"
|
||||||
if tag == "" || tag == "beta" {
|
if tag == "" || tag == "beta" {
|
||||||
tag = "latest"
|
tag = "latest"
|
||||||
}
|
}
|
||||||
@@ -843,10 +848,10 @@ func InstallMoltbotNpm(tag string) error {
|
|||||||
|
|
||||||
// EnsureOnPath 检查并配置 PATH
|
// EnsureOnPath 检查并配置 PATH
|
||||||
func EnsureOnPath() (bool, error) {
|
func EnsureOnPath() (bool, error) {
|
||||||
if _, err := exec.LookPath("clawdbot"); err == nil {
|
if _, err := exec.LookPath("openclaw"); err == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if _, err := exec.LookPath("moltbot"); err == nil {
|
if _, err := exec.LookPath("clawdbot"); err == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,8 +863,8 @@ func EnsureOnPath() (bool, error) {
|
|||||||
|
|
||||||
possiblePath := npmPrefix
|
possiblePath := npmPrefix
|
||||||
|
|
||||||
if _, err := os.Stat(filepath.Join(npmPrefix, "clawdbot.cmd")); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join(npmPrefix, "openclaw.cmd")); os.IsNotExist(err) {
|
||||||
if _, err := os.Stat(filepath.Join(npmPrefix, "moltbot.cmd")); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join(npmPrefix, "clawdbot.cmd")); os.IsNotExist(err) {
|
||||||
possiblePath = npmBin
|
possiblePath = npmBin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -878,9 +883,9 @@ func EnsureOnPath() (bool, error) {
|
|||||||
|
|
||||||
// RunDoctor 运行诊断
|
// RunDoctor 运行诊断
|
||||||
func RunDoctor() error {
|
func RunDoctor() error {
|
||||||
cmdName, err := GetMoltbotPath()
|
cmdName, err := GetOpenclawPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmdName = "moltbot"
|
cmdName = "openclaw"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command("cmd", "/c", cmdName, "doctor", "--non-interactive")
|
cmd := exec.Command("cmd", "/c", cmdName, "doctor", "--non-interactive")
|
||||||
@@ -889,9 +894,9 @@ func RunDoctor() error {
|
|||||||
|
|
||||||
// RunOnboard 运行引导
|
// RunOnboard 运行引导
|
||||||
func RunOnboard() error {
|
func RunOnboard() error {
|
||||||
cmdName, err := GetMoltbotPath()
|
cmdName, err := GetOpenclawPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmdName = "moltbot"
|
cmdName = "openclaw"
|
||||||
}
|
}
|
||||||
cmd := exec.Command("cmd", "/c", cmdName, "onboard")
|
cmd := exec.Command("cmd", "/c", cmdName, "onboard")
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
@@ -917,13 +922,13 @@ func GenerateAndWriteConfig(opts ConfigOptions) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("无法获取用户目录: %v", err)
|
return fmt.Errorf("无法获取用户目录: %v", err)
|
||||||
}
|
}
|
||||||
configDir := filepath.Join(userHome, ".clawdbot")
|
configDir := filepath.Join(userHome, ".openclaw")
|
||||||
if err := os.MkdirAll(configDir, 0755); err != nil {
|
if err := os.MkdirAll(configDir, 0755); err != nil {
|
||||||
return fmt.Errorf("创建配置目录失败: %v", err)
|
return fmt.Errorf("创建配置目录失败: %v", err)
|
||||||
}
|
}
|
||||||
configFile := filepath.Join(configDir, "clawdbot.json")
|
configFile := filepath.Join(configDir, "openclaw.json")
|
||||||
|
|
||||||
config := MoltbotConfig{
|
config := OpenclawConfig{
|
||||||
Gateway: GatewayConfig{
|
Gateway: GatewayConfig{
|
||||||
Mode: "local",
|
Mode: "local",
|
||||||
Bind: "loopback",
|
Bind: "loopback",
|
||||||
@@ -1018,9 +1023,9 @@ func GenerateAndWriteConfig(opts ConfigOptions) error {
|
|||||||
|
|
||||||
// StartGateway 启动网关
|
// StartGateway 启动网关
|
||||||
func StartGateway() error {
|
func StartGateway() error {
|
||||||
cmdName, err := GetMoltbotPath()
|
cmdName, err := GetOpenclawPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmdName = "moltbot"
|
cmdName = "openclaw"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(cmdName, "gateway", "--verbose")
|
cmd := exec.Command(cmdName, "gateway", "--verbose")
|
||||||
@@ -1073,14 +1078,14 @@ func KillGateway() error {
|
|||||||
return killCmd.Run()
|
return killCmd.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UninstallMoltbot 卸载清理
|
// UninstallOpenclaw 卸载清理
|
||||||
func UninstallMoltbot() error {
|
func UninstallOpenclaw() error {
|
||||||
npmPath, err := getNpmPath()
|
npmPath, err := getNpmPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
packages := []string{"clawdbot", "moltbot"}
|
packages := []string{"openclaw", "clawdbot", "moltbot"}
|
||||||
for _, pkg := range packages {
|
for _, pkg := range packages {
|
||||||
cmd := exec.Command(npmPath, "uninstall", "-g", pkg)
|
cmd := exec.Command(npmPath, "uninstall", "-g", pkg)
|
||||||
cmd.Stdout = nil
|
cmd.Stdout = nil
|
||||||
@@ -1090,11 +1095,14 @@ func UninstallMoltbot() error {
|
|||||||
|
|
||||||
userHome, err := os.UserHomeDir()
|
userHome, err := os.UserHomeDir()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
configDir := filepath.Join(userHome, ".clawdbot")
|
configDir := filepath.Join(userHome, ".openclaw")
|
||||||
os.RemoveAll(configDir)
|
os.RemoveAll(configDir)
|
||||||
|
|
||||||
legacyDir := filepath.Join(userHome, ".moltbot")
|
legacyDir := filepath.Join(userHome, ".clawdbot")
|
||||||
os.RemoveAll(legacyDir)
|
os.RemoveAll(legacyDir)
|
||||||
|
|
||||||
|
legacyDir2 := filepath.Join(userHome, ".moltbot")
|
||||||
|
os.RemoveAll(legacyDir2)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"moltbot-installer/internal/style"
|
"openclaw-installer/internal/style"
|
||||||
"moltbot-installer/internal/sys"
|
"openclaw-installer/internal/sys"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/spinner"
|
"github.com/charmbracelet/bubbles/spinner"
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
@@ -71,8 +71,8 @@ type Model struct {
|
|||||||
// 系统状态缓存
|
// 系统状态缓存
|
||||||
nodeVer string
|
nodeVer string
|
||||||
nodeOk bool
|
nodeOk bool
|
||||||
moltbotVer string
|
openclawVer string
|
||||||
moltbotOk bool
|
openclawOk bool
|
||||||
gitVer string
|
gitVer string
|
||||||
gitOk bool
|
gitOk bool
|
||||||
gatewayOk bool
|
gatewayOk bool
|
||||||
@@ -88,8 +88,8 @@ type Model struct {
|
|||||||
type checkMsg struct {
|
type checkMsg struct {
|
||||||
nodeVer string
|
nodeVer string
|
||||||
nodeOk bool
|
nodeOk bool
|
||||||
moltbotVer string
|
openclawVer string
|
||||||
moltbotInstalled bool
|
openclawInstalled bool
|
||||||
gitVer string
|
gitVer string
|
||||||
gitOk bool
|
gitOk bool
|
||||||
gatewayRunning bool
|
gatewayRunning bool
|
||||||
@@ -162,15 +162,15 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
case checkMsg:
|
case checkMsg:
|
||||||
m.nodeVer = msg.nodeVer
|
m.nodeVer = msg.nodeVer
|
||||||
m.nodeOk = msg.nodeOk
|
m.nodeOk = msg.nodeOk
|
||||||
m.moltbotVer = msg.moltbotVer
|
m.openclawVer = msg.openclawVer
|
||||||
m.moltbotOk = msg.moltbotInstalled
|
m.openclawOk = msg.openclawInstalled
|
||||||
m.gitVer = msg.gitVer
|
m.gitVer = msg.gitVer
|
||||||
m.gitOk = msg.gitOk
|
m.gitOk = msg.gitOk
|
||||||
m.gatewayOk = msg.gatewayRunning
|
m.gatewayOk = msg.gatewayRunning
|
||||||
m.checkDone = true
|
m.checkDone = true
|
||||||
if m.envRefreshActive {
|
if m.envRefreshActive {
|
||||||
expect := m.envRefreshExpectInstalled
|
expect := m.envRefreshExpectInstalled
|
||||||
if m.nodeOk == expect && m.gitOk == expect && m.moltbotOk == expect {
|
if m.nodeOk == expect && m.gitOk == expect && m.openclawOk == expect {
|
||||||
m.envRefreshActive = false
|
m.envRefreshActive = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ func (m Model) View() string {
|
|||||||
|
|
||||||
func (m Model) renderDashboard() string {
|
func (m Model) renderDashboard() string {
|
||||||
// 1. 标题
|
// 1. 标题
|
||||||
header := style.HeaderStyle.Render("Moltbot Installer")
|
header := style.HeaderStyle.Render("OpenClaw Installer")
|
||||||
|
|
||||||
// 2. 状态栏
|
// 2. 状态栏
|
||||||
nodeStatus := style.Badge("检测中...", "info")
|
nodeStatus := style.Badge("检测中...", "info")
|
||||||
@@ -430,16 +430,16 @@ func (m Model) renderDashboard() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
moltStatus := style.Badge("检测中...", "info")
|
openclawStatus := style.Badge("检测中...", "info")
|
||||||
if m.checkDone {
|
if m.checkDone {
|
||||||
if m.moltbotOk {
|
if m.openclawOk {
|
||||||
ver := m.moltbotVer
|
ver := m.openclawVer
|
||||||
if ver == "" {
|
if ver == "" {
|
||||||
ver = "已安装"
|
ver = "已安装"
|
||||||
}
|
}
|
||||||
moltStatus = style.Badge(ver, "success")
|
openclawStatus = style.Badge(ver, "success")
|
||||||
} else {
|
} else {
|
||||||
moltStatus = style.Badge("未安装", "warning")
|
openclawStatus = style.Badge("未安装", "warning")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,7 +468,7 @@ func (m Model) renderDashboard() string {
|
|||||||
style.SubHeaderStyle.Render("系统状态"),
|
style.SubHeaderStyle.Render("系统状态"),
|
||||||
fmt.Sprintf("Node.js 环境: %s", nodeStatus),
|
fmt.Sprintf("Node.js 环境: %s", nodeStatus),
|
||||||
fmt.Sprintf("Git 环境: %s", gitStatus),
|
fmt.Sprintf("Git 环境: %s", gitStatus),
|
||||||
fmt.Sprintf("Moltbot 核心: %s", moltStatus),
|
fmt.Sprintf("OpenClaw 核心: %s", openclawStatus),
|
||||||
fmt.Sprintf("网关进程: %s", gwStatus),
|
fmt.Sprintf("网关进程: %s", gwStatus),
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ func (m Model) renderDashboard() string {
|
|||||||
{"启动/重启服务", "管理后台网关进程"},
|
{"启动/重启服务", "管理后台网关进程"},
|
||||||
{"配置向导", "设置 API 密钥与机器人参数"},
|
{"配置向导", "设置 API 密钥与机器人参数"},
|
||||||
{"安装/更新环境", "一键部署 Node.js 与核心组件"},
|
{"安装/更新环境", "一键部署 Node.js 与核心组件"},
|
||||||
{"卸载 Moltbot", "清理所有文件与配置"},
|
{"卸载 OpenClaw", "清理所有文件与配置"},
|
||||||
{"退出", "关闭控制台"},
|
{"退出", "关闭控制台"},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ func (m Model) renderWizard() string {
|
|||||||
style.SubHeaderStyle.Render("Step 3: 确认配置"),
|
style.SubHeaderStyle.Render("Step 3: 确认配置"),
|
||||||
"",
|
"",
|
||||||
"配置已就绪,准备写入文件。",
|
"配置已就绪,准备写入文件。",
|
||||||
style.DescriptionStyle.Render("路径: ~/.clawdbot/clawdbot.json"),
|
style.DescriptionStyle.Render("路径: ~/.openclaw/openclaw.json"),
|
||||||
"",
|
"",
|
||||||
style.SubtleStyle.Render("Enter 确认写入,Esc 取消"),
|
style.SubtleStyle.Render("Enter 确认写入,Esc 取消"),
|
||||||
)
|
)
|
||||||
@@ -635,14 +635,14 @@ func (m Model) renderAction() string {
|
|||||||
func checkEnvCmd() tea.Msg {
|
func checkEnvCmd() tea.Msg {
|
||||||
sys.ResetPathCache()
|
sys.ResetPathCache()
|
||||||
nodeVer, nodeOk := sys.CheckNode()
|
nodeVer, nodeOk := sys.CheckNode()
|
||||||
moltVer, moltOk := sys.CheckMoltbot()
|
openclawVer, openclawOk := sys.CheckOpenclaw()
|
||||||
gitVer, gitOk := sys.CheckGit()
|
gitVer, gitOk := sys.CheckGit()
|
||||||
gwRun := sys.IsGatewayRunning()
|
gwRun := sys.IsGatewayRunning()
|
||||||
return checkMsg{
|
return checkMsg{
|
||||||
nodeVer: nodeVer,
|
nodeVer: nodeVer,
|
||||||
nodeOk: nodeOk,
|
nodeOk: nodeOk,
|
||||||
moltbotVer: moltVer,
|
openclawVer: openclawVer,
|
||||||
moltbotInstalled: moltOk,
|
openclawInstalled: openclawOk,
|
||||||
gitVer: gitVer,
|
gitVer: gitVer,
|
||||||
gitOk: gitOk,
|
gitOk: gitOk,
|
||||||
gatewayRunning: gwRun,
|
gatewayRunning: gwRun,
|
||||||
@@ -684,7 +684,7 @@ func runUninstallCmd() tea.Msg {
|
|||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
// 2. 卸载文件
|
// 2. 卸载文件
|
||||||
err := sys.UninstallMoltbot()
|
err := sys.UninstallOpenclaw()
|
||||||
return actionResultMsg{err: err}
|
return actionResultMsg{err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ func runSaveConfigCmd(opts sys.ConfigOptions) tea.Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runInstallFlowCmd() tea.Msg {
|
func runInstallFlowCmd() tea.Msg {
|
||||||
// 线性流程: 检查Node -> 安装Node -> 检查Git -> 安装Git -> 配置NPM -> 安装Moltbot -> 配置系统
|
// 线性流程: 检查Node -> 安装Node -> 检查Git -> 安装Git -> 配置NPM -> 安装OpenClaw -> 配置系统
|
||||||
// 为简化状态,使用阻塞执行
|
// 为简化状态,使用阻塞执行
|
||||||
|
|
||||||
err := sys.InstallNode()
|
err := sys.InstallNode()
|
||||||
@@ -719,9 +719,9 @@ func runInstallFlowCmd() tea.Msg {
|
|||||||
return actionResultMsg{err: fmt.Errorf("npm 配置失败: %v", err)}
|
return actionResultMsg{err: fmt.Errorf("npm 配置失败: %v", err)}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sys.InstallMoltbotNpm("latest")
|
err = sys.InstallOpenclawNpm("latest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return actionResultMsg{err: fmt.Errorf("moltbot 安装失败: %v", err)}
|
return actionResultMsg{err: fmt.Errorf("openclaw 安装失败: %v", err)}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = sys.EnsureOnPath()
|
_, err = sys.EnsureOnPath()
|
||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"moltbot-installer/internal/ui"
|
"openclaw-installer/internal/ui"
|
||||||
|
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user