diff --git a/install.sh b/install.sh index 2890822..6b34045 100644 --- a/install.sh +++ b/install.sh @@ -766,7 +766,7 @@ set +e run_migration migration_rc=$? set -e -if (( migration_rc != 0 )); then +if [[ $migration_rc -ne 0 ]]; then persist_installer_log if (( EXISTING_DB )); then die "已有数据库迁移失败(退出码:$migration_rc)" @@ -774,9 +774,15 @@ if (( migration_rc != 0 )); then die "数据库初始化失败(退出码:$migration_rc)" fi printf '数据库初始化完成\n' +printf '数据库初始化完成\n' >>"$INSTALL_LOG" progress '启动 XyMediaVault 服务' -if ! run_logged "${COMPOSE[@]}" --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" up -d app; then - die 'XyMediaVault 启动失败' +set +e +run_logged "${COMPOSE[@]}" --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" up -d app +app_start_rc=$? +set -e +if [[ $app_start_rc -ne 0 ]]; then + persist_installer_log + die "XyMediaVault 启动失败(退出码:$app_start_rc)" fi wait_for_app_health() { local started_at elapsed app_wait_interrupted=0 previous_int previous_term