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. */
| 11319 | * the final guarded activation after the verified binary is ready. Returns 0 |
| 11320 | * to continue and 1 to abort. */ |
| 11321 | static int update_prepare_clear_indexes(const char *home, bool dry_run, bool *delete_indexes_out) { |
| 11322 | if (delete_indexes_out) { |
| 11323 | *delete_indexes_out = false; |
| 11324 | } |
| 11325 | int index_count = count_db_indexes(home); |
| 11326 | if (index_count == 0) { |
| 11327 | return 0; |
| 11328 | } |
| 11329 | printf("Found %d existing index(es) that must be rebuilt after update:\n", index_count); |
| 11330 | cbm_list_indexes(home); |
| 11331 | printf("\n"); |
| 11332 | if (dry_run) { |
| 11333 | printf("(dry-run — indexes would be deleted)\n\n"); |
| 11334 | return 0; |
| 11335 | } |
| 11336 | if (!prompt_yn("Delete these indexes and continue with update?")) { |
| 11337 | printf("Update cancelled.\n"); |
| 11338 | return CLI_TRUE; |
| 11339 | } |
| 11340 | if (delete_indexes_out) { |
| 11341 | *delete_indexes_out = true; |
| 11342 | } |
| 11343 | return 0; |
| 11344 | } |
| 11345 | |
| 11346 | /* Download and verify before disruption, then activate under daemon locks. */ |
| 11347 | static int download_verify_install(const char *url, const char *ext, const char *os, |
no test coverage detected