Confirm index deletion before network I/O, but defer the deletion itself to * the final guarded activation after the verified binary is ready. Returns 0 * to continue and 1 to abort. */
| 11270 | * the final guarded activation after the verified binary is ready. Returns 0 |
| 11271 | * to continue and 1 to abort. */ |
| 11272 | static int update_prepare_clear_indexes(const char *home, bool dry_run, bool *delete_indexes_out) { |
| 11273 | if (delete_indexes_out) { |
| 11274 | *delete_indexes_out = false; |
| 11275 | } |
| 11276 | int index_count = count_db_indexes(home); |
| 11277 | if (index_count == 0) { |
| 11278 | return 0; |
| 11279 | } |
| 11280 | printf("Found %d existing index(es) that must be rebuilt after update:\n", index_count); |
| 11281 | cbm_list_indexes(home); |
| 11282 | printf("\n"); |
| 11283 | if (dry_run) { |
| 11284 | printf("(dry-run — indexes would be deleted)\n\n"); |
| 11285 | return 0; |
| 11286 | } |
| 11287 | if (!prompt_yn("Delete these indexes and continue with update?")) { |
| 11288 | printf("Update cancelled.\n"); |
| 11289 | return CLI_TRUE; |
| 11290 | } |
| 11291 | if (delete_indexes_out) { |
| 11292 | *delete_indexes_out = true; |
| 11293 | } |
| 11294 | return 0; |
| 11295 | } |
| 11296 | |
| 11297 | /* Download and verify before disruption, then activate under daemon locks. */ |
| 11298 | static int download_verify_install(const char *url, const char *ext, const char *os, |
no test coverage detected