v3.2: 非交互模式跳过 onboard 并以 0 退出(预期行为非失败)

This commit is contained in:
2026-08-10 05:31:55 +00:00
parent f4f5c63290
commit 4599c4d34c
+11 -3
View File
@@ -863,9 +863,13 @@ onboard_and_start() {
ok "检测到 OpenClaw gateway 已在运行,跳过初始化。" ok "检测到 OpenClaw gateway 已在运行,跳过初始化。"
else else
if [ "$NONINTERACTIVE" = "1" ] || [ ! -t 0 ]; then if [ "$NONINTERACTIVE" = "1" ] || [ ! -t 0 ]; then
info "非交互模式:执行 openclaw onboard --install-daemon(自动模式)…" # 非交互模式:onboard 需要 TTY 交互(选模型/配渠道),无法自动完成。
run_quiet openclaw onboard --install-daemon || \ # 此时未配置任何 provider/渠道,即使强行启动 gateway 也不可用,
warn "onboard 未成功完成,稍后可手动运行:openclaw onboard --install-daemon" # 因此直接跳过并给出明确后续指引,这是预期行为而非失败。
NONINTERACTIVE_SKIPPED=1
warn "非交互模式:已跳过初始化与启动。"
hint "OpenClaw 已安装完成,但尚未配置。请在交互终端中执行 ${C_BOLD}claw${C_RESET} 完成配置后再启动。"
return 0
else else
plain "接下来运行 ${C_BOLD}openclaw onboard --install-daemon${C_RESET} 完成初始化并安装 systemd 服务。" plain "接下来运行 ${C_BOLD}openclaw onboard --install-daemon${C_RESET} 完成初始化并安装 systemd 服务。"
plain "该命令可能会有自己的交互提问,按屏幕提示回答即可。" plain "该命令可能会有自己的交互提问,按屏幕提示回答即可。"
@@ -1181,6 +1185,10 @@ main() {
summary summary
if [ "${NONINTERACTIVE_SKIPPED:-0}" = "1" ]; then
ok "安装完成。请在交互终端执行 claw 完成配置并启动。"
exit 0
fi
if [ "$start_rc" -eq 0 ]; then if [ "$start_rc" -eq 0 ]; then
ok "全部完成,祝使用愉快。" ok "全部完成,祝使用愉快。"
exit 0 exit 0