Skip to content

Commit e78b9d3

Browse files
authored
fix(install): defer success until verification (#126871)
1 parent fa71a6f commit e78b9d3

2 files changed

Lines changed: 331 additions & 74 deletions

File tree

‎scripts/install.sh‎

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,9 @@ main() {
37523752
local is_upgrade=false
37533753
if check_existing_openclaw; then
37543754
is_upgrade=true
3755+
VERIFY_INSTALL=1
37553756
fi
3757+
configure_install_stage_total
37563758
local should_open_dashboard=false
37573759

37583760
ui_stage "Preparing environment"
@@ -3825,75 +3827,17 @@ main() {
38253827
fi
38263828
fi
38273829

3828-
local config_present=false
3830+
local config_present=false defer_success=false
38293831
if has_openclaw_config; then
38303832
config_present=true
38313833
refresh_gateway_service_if_loaded
38323834
fi
38333835

3834-
local installed_version=""
3835-
if [[ "$is_upgrade" != "true" ]]; then
3836-
installed_version="$(resolve_openclaw_version)"
3837-
echo ""
3838-
if [[ -n "$installed_version" ]]; then
3839-
ui_celebrate "🦞 OpenClaw installed successfully (${installed_version})!"
3840-
else
3841-
ui_celebrate "🦞 OpenClaw installed successfully!"
3842-
fi
3843-
local completion_messages=(
3844-
"Ahh nice, I like it here. Got any snacks? "
3845-
"Home sweet home. Don't worry, I won't rearrange the furniture."
3846-
"I'm in. Let's cause some responsible chaos."
3847-
"Installation complete. Your productivity is about to get weird."
3848-
"Settled in. Time to automate your life whether you're ready or not."
3849-
"Cozy. I've already read your calendar. We need to talk."
3850-
"Finally unpacked. Now point me at your problems."
3851-
"cracks claws Alright, what are we building?"
3852-
"The lobster has landed. Your terminal will never be the same."
3853-
"All done! I promise to only judge your code a little bit."
3854-
)
3855-
local completion_message
3856-
completion_message="${completion_messages[RANDOM % ${#completion_messages[@]}]}"
3857-
echo -e "${MUTED}${completion_message}${NC}"
3858-
echo ""
3859-
fi
3860-
3861-
if [[ "$INSTALL_METHOD" == "git" && -n "$final_git_dir" ]]; then
3862-
local user_claw
3863-
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3864-
ui_section "Source install details"
3865-
ui_kv "Checkout" "$final_git_dir"
3866-
ui_kv "Wrapper" "$HOME/.local/bin/openclaw"
3867-
ui_kv "Update command" "${user_claw} update"
3868-
ui_kv "Switch to npm" "curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method npm"
3836+
if [[ "$is_upgrade" == "true" || "$config_present" == "true" || "$VERIFY_INSTALL" == "1" ]]; then
3837+
defer_success=true
38693838
fi
38703839

3871-
if [[ "$config_present" != "true" ]]; then
3872-
if [[ "$NO_ONBOARD" == "1" ]]; then
3873-
local user_claw
3874-
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3875-
ui_info "Skipping onboard (requested); run ${user_claw} onboard later"
3876-
else
3877-
ui_info "Starting setup"
3878-
echo ""
3879-
if is_promptable; then
3880-
local claw="${OPENCLAW_BIN:-}"
3881-
if [[ -z "$claw" ]]; then
3882-
claw="$(resolve_installed_openclaw_bin || true)"
3883-
fi
3884-
if [[ -z "$claw" ]]; then
3885-
ui_info "Skipping onboarding (openclaw not on PATH yet)"
3886-
warn_openclaw_not_found
3887-
return 0
3888-
fi
3889-
exec </dev/tty
3890-
exec "$claw" onboard
3891-
fi
3892-
local user_claw
3893-
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3894-
ui_info "No TTY; run ${user_claw} onboard to finish setup"
3895-
fi
3896-
elif [[ "$is_upgrade" == "true" ]]; then
3840+
if [[ "$config_present" == "true" && "$is_upgrade" == "true" ]]; then
38973841
if has_controlling_tty || [[ "$NO_ONBOARD" == "1" || "$NO_PROMPT" == "1" ]]; then
38983842
local claw="${OPENCLAW_BIN:-}"
38993843
if [[ -z "$claw" ]]; then
@@ -3932,7 +3876,7 @@ main() {
39323876
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
39333877
ui_info "No TTY; run ${user_claw} plugins update --all manually"
39343878
fi
3935-
else
3879+
elif [[ "$config_present" == "true" ]]; then
39363880
ui_info "Config already present; running doctor"
39373881
run_doctor || return $?
39383882
should_open_dashboard=true
@@ -3960,22 +3904,79 @@ main() {
39603904
fi
39613905
fi
39623906

3963-
if [[ "$is_upgrade" == "true" ]]; then
3964-
VERIFY_INSTALL=1
3965-
fi
3966-
if ! verify_installation "$config_present"; then
3967-
exit 1
3907+
if [[ "$defer_success" == "true" ]] && ! verify_installation "$config_present"; then
3908+
if [[ "$config_present" != "true" && "$NO_ONBOARD" != "1" ]] && ! is_promptable; then
3909+
local user_claw
3910+
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3911+
ui_info "No TTY; run ${user_claw} onboard to finish setup"
3912+
fi
3913+
return 1
39683914
fi
39693915

3916+
local installed_version=""
3917+
installed_version="$(resolve_openclaw_version)"
3918+
echo ""
3919+
if [[ -n "$installed_version" ]]; then
3920+
ui_celebrate "🦞 OpenClaw installed successfully (${installed_version})!"
3921+
else
3922+
ui_celebrate "🦞 OpenClaw installed successfully!"
3923+
fi
39703924
if [[ "$is_upgrade" == "true" ]]; then
3971-
installed_version="$(resolve_openclaw_version)"
3925+
ui_info "Upgrade complete"
3926+
else
3927+
local completion_messages=(
3928+
"Ahh nice, I like it here. Got any snacks? "
3929+
"Home sweet home. Don't worry, I won't rearrange the furniture."
3930+
"I'm in. Let's cause some responsible chaos."
3931+
"Installation complete. Your productivity is about to get weird."
3932+
"Settled in. Time to automate your life whether you're ready or not."
3933+
"Cozy. I've already read your calendar. We need to talk."
3934+
"Finally unpacked. Now point me at your problems."
3935+
"cracks claws Alright, what are we building?"
3936+
"The lobster has landed. Your terminal will never be the same."
3937+
"All done! I promise to only judge your code a little bit."
3938+
)
3939+
local completion_message
3940+
completion_message="${completion_messages[RANDOM % ${#completion_messages[@]}]}"
3941+
echo -e "${MUTED}${completion_message}${NC}"
39723942
echo ""
3973-
if [[ -n "$installed_version" ]]; then
3974-
ui_celebrate "🦞 OpenClaw installed successfully (${installed_version})!"
3943+
fi
3944+
3945+
if [[ "$INSTALL_METHOD" == "git" && -n "$final_git_dir" ]]; then
3946+
local user_claw
3947+
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3948+
ui_section "Source install details"
3949+
ui_kv "Checkout" "$final_git_dir"
3950+
ui_kv "Wrapper" "$HOME/.local/bin/openclaw"
3951+
ui_kv "Update command" "${user_claw} update"
3952+
ui_kv "Switch to npm" "curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method npm"
3953+
fi
3954+
3955+
if [[ "$config_present" != "true" ]]; then
3956+
if [[ "$NO_ONBOARD" == "1" ]]; then
3957+
local user_claw
3958+
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3959+
ui_info "Skipping onboard (requested); run ${user_claw} onboard later"
39753960
else
3976-
ui_celebrate "🦞 OpenClaw installed successfully!"
3961+
ui_info "Starting setup"
3962+
echo ""
3963+
if is_promptable; then
3964+
local claw="${OPENCLAW_BIN:-}"
3965+
if [[ -z "$claw" ]]; then
3966+
claw="$(resolve_installed_openclaw_bin || true)"
3967+
fi
3968+
if [[ -z "$claw" ]]; then
3969+
ui_info "Skipping onboarding (openclaw not on PATH yet)"
3970+
warn_openclaw_not_found
3971+
return 0
3972+
fi
3973+
exec </dev/tty
3974+
exec "$claw" onboard
3975+
fi
3976+
local user_claw
3977+
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
3978+
ui_info "No TTY; run ${user_claw} onboard to finish setup"
39773979
fi
3978-
ui_info "Upgrade complete"
39793980
fi
39803981

39813982
if [[ "$should_open_dashboard" == "true" ]]; then
@@ -3987,7 +3988,6 @@ main() {
39873988

39883989
if [[ "${OPENCLAW_INSTALL_SH_NO_RUN:-0}" != "1" ]]; then
39893990
parse_args "$@"
3990-
configure_install_stage_total
39913991
configure_verbose
39923992
main
39933993
fi

0 commit comments

Comments
 (0)