v3.1: 修复官方装器参数(--yes 不存在, 改 --no-prompt --no-onboard) + 补回被误删的 node_major/openclaw_local_version/openclaw_remote_version/npm_install_openclaw

This commit is contained in:
2026-08-10 05:26:08 +00:00
parent c314493e1e
commit f4f5c63290
+24 -2
View File
@@ -354,6 +354,28 @@ node_major() {
printf '%s' "${v%%.*}"
}
node_major() {
node -v 2>/dev/null | sed 's/^v//' | cut -d. -f1
}
openclaw_local_version() {
npm list -g openclaw --depth=0 --no-update-notifier 2>/dev/null \
| grep openclaw | awk '{print $NF}' | sed 's/^.*@//'
}
openclaw_remote_version() {
npm view openclaw version --no-update-notifier 2>/dev/null
}
npm_install_openclaw() {
info "正在执行 npm install -g openclaw@latest(首次安装可能需要几分钟)…"
if run_quiet npm install -g openclaw@latest --no-update-notifier; then
return 0
fi
warn "首次安装失败,重试一次…"
run_quiet npm install -g openclaw@latest --no-update-notifier
}
install_node() {
title "安装 Node.js 与 OpenClaw(官方安装器)"
info "调用官方安装器 https://openclaw.ai/install.sh"
@@ -375,8 +397,8 @@ install_node() {
die "官方安装器内容异常(不是脚本)。" "可能被网络劫持,请检查网络环境后重试。"
fi
_log "RUN: bash official install.sh --yes"
if bash "$tmp_inst" --yes 2>&1 | tee -a "$LOG_FILE"; then
_log "RUN: bash official install.sh --no-prompt"
if bash "$tmp_inst" --no-prompt --no-onboard 2>&1 | tee -a "$LOG_FILE"; then
ok "官方安装器执行完成"
else
warn "官方安装器返回非零状态,继续检查实际安装结果。"