Add pre-update/clean backup feature
All checks were successful
Build / Build (push) Successful in 12s
All checks were successful
Build / Build (push) Successful in 12s
- Backup deletion paths before update to sd:/backup/OmniNX/{version}
- Backup deletion paths before clean install to sd:/backup/OmniNX/pre-omninx
- Best-effort backup: continue install even if some copies fail
- Fix directory creation: ensure parent dirs exist before folder_copy
- Step 1 for update: Backup; Step 1-2 for clean: user data + pre-omninx backup
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -591,9 +591,29 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||
int res;
|
||||
|
||||
if (mode == INSTALL_MODE_UPDATE) {
|
||||
// Update mode: selective cleanup then install
|
||||
// Update mode: backup, selective cleanup, then install
|
||||
omninx_status_t status = detect_omninx_installation();
|
||||
const char *version = (status.version_file[0] != '\0') ? status.version_file : "unknown";
|
||||
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 1: Bereinigung...\n");
|
||||
gfx_printf("Schritt 1: Backup vor Update (%s)...\n", version);
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = backup_before_update(version);
|
||||
/* Backup is best-effort; continue install even on failure */
|
||||
if (res == FR_OK) {
|
||||
install_set_color(COLOR_GREEN);
|
||||
gfx_printf(" [OK] Sicherung nach sd:/backup/OmniNX/%s/\n", version);
|
||||
install_set_color(COLOR_WHITE);
|
||||
} else {
|
||||
install_set_color(COLOR_ORANGE);
|
||||
gfx_printf(" [WARN] Backup fehlgeschlagen, fahre trotzdem fort...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
}
|
||||
|
||||
install_check_and_clear_screen_if_needed();
|
||||
gfx_printf("\n");
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 2: Bereinigung...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = update_mode_cleanup(pack_variant);
|
||||
if (res != FR_OK) return res;
|
||||
@@ -601,7 +621,7 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||
install_check_and_clear_screen_if_needed();
|
||||
gfx_printf("\n");
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 2: Dateien kopieren...\n");
|
||||
gfx_printf("Schritt 3: Dateien kopieren...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = update_mode_install(pack_variant);
|
||||
if (res != FR_OK) return res;
|
||||
@@ -614,7 +634,7 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||
res = cleanup_other_staging_directories(pack_variant);
|
||||
return res;
|
||||
} else {
|
||||
// Clean mode: backup, wipe, restore, install
|
||||
// Clean mode: backup user data, backup pre-omninx, wipe, restore, install
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 1: Sichere Benutzerdaten...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
@@ -624,7 +644,23 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||
install_check_and_clear_screen_if_needed();
|
||||
gfx_printf("\n");
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 2: Bereinige alte Installation...\n");
|
||||
gfx_printf("Schritt 2: Backup alter CFW-Dateien (pre-omninx)...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = backup_before_clean();
|
||||
if (res == FR_OK) {
|
||||
install_set_color(COLOR_GREEN);
|
||||
gfx_printf(" [OK] Sicherung nach sd:/backup/OmniNX/pre-omninx/\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
} else {
|
||||
install_set_color(COLOR_ORANGE);
|
||||
gfx_printf(" [WARN] Backup fehlgeschlagen, fahre trotzdem fort...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
}
|
||||
|
||||
install_check_and_clear_screen_if_needed();
|
||||
gfx_printf("\n");
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 3: Bereinige alte Installation...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = clean_mode_wipe();
|
||||
if (res != FR_OK) return res;
|
||||
@@ -632,7 +668,7 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||
install_check_and_clear_screen_if_needed();
|
||||
gfx_printf("\n");
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 3: Stelle Benutzerdaten wieder her...\n");
|
||||
gfx_printf("Schritt 4: Stelle Benutzerdaten wieder her...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = clean_mode_restore();
|
||||
if (res != FR_OK) return res;
|
||||
@@ -640,7 +676,7 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||
install_check_and_clear_screen_if_needed();
|
||||
gfx_printf("\n");
|
||||
install_set_color(COLOR_YELLOW);
|
||||
gfx_printf("Schritt 4: Dateien kopieren...\n");
|
||||
gfx_printf("Schritt 5: Dateien kopieren...\n");
|
||||
install_set_color(COLOR_WHITE);
|
||||
res = clean_mode_install(pack_variant);
|
||||
if (res != FR_OK) return res;
|
||||
|
||||
Reference in New Issue
Block a user