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. */
| 11986 | * the final guarded activation after the verified binary is ready. Returns 0 |
| 11987 | * to continue and 1 to abort. */ |
| 11988 | static int update_prepare_clear_indexes(const char *home, bool dry_run, bool *delete_indexes_out) { |
| 11989 | if (delete_indexes_out) { |
| 11990 | *delete_indexes_out = false; |
| 11991 | } |
| 11992 | int index_count = count_db_indexes(home); |
| 11993 | if (index_count == 0) { |
| 11994 | return 0; |
| 11995 | } |
| 11996 | printf("Found %d existing index(es) that must be rebuilt after update:\n", index_count); |
| 11997 | cbm_list_indexes(home); |
| 11998 | printf("\n"); |
| 11999 | if (dry_run) { |
| 12000 | printf("(dry-run — indexes would be deleted)\n\n"); |
| 12001 | return 0; |
| 12002 | } |
| 12003 | if (!prompt_yn("Delete these indexes and continue with update?")) { |
| 12004 | printf("Update cancelled.\n"); |
| 12005 | return CLI_TRUE; |
| 12006 | } |
| 12007 | if (delete_indexes_out) { |
| 12008 | *delete_indexes_out = true; |
| 12009 | } |
| 12010 | return 0; |
| 12011 | } |
| 12012 | |
| 12013 | /* Download and verify before disruption, then activate under daemon locks. */ |
| 12014 | static int download_verify_install(const char *url, const char *ext, const char *os, |
no test coverage detected