install: backup and restore HorizonOC config.ini on OC pack update

- Copy sd:/config/horizon-oc/config.ini to sd:/.omninx_oc_update before
  update cleanup/copy; restore after Hekate step, then remove the scratch dir.
- Only when INSTALL_MODE_UPDATE and VARIANT_OC.

Made-with: Cursor
This commit is contained in:
2026-04-09 22:11:30 +02:00
parent f71b6ab629
commit 13c35400a1
3 changed files with 80 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
*/
#include "install.h"
#include "backup.h"
#include "fs.h"
#include "screenshot.h"
#include "version.h"
@@ -872,6 +873,21 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
int res;
if (mode == INSTALL_MODE_UPDATE) {
if (pack_variant == VARIANT_OC) {
bool had_horizon_cfg = install_path_exists(HORIZON_OC_CONFIG_PATH);
install_set_color(COLOR_YELLOW);
gfx_printf("HorizonOC: Sichere config.ini...\n");
install_set_color(COLOR_WHITE);
res = backup_horizon_oc_config_for_oc_update();
if (res != FR_OK)
return res;
if (had_horizon_cfg) {
install_set_color(COLOR_GREEN);
gfx_printf(" [OK] Bestehende config.ini gesichert.\n");
install_set_color(COLOR_WHITE);
}
}
// Update mode: selective cleanup then install
install_set_color(COLOR_YELLOW);
gfx_printf("Schritt 1: Bereinigung...\n");
@@ -889,6 +905,26 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
install_hekate_8gb_post_copy();
if (pack_variant == VARIANT_OC) {
bool had_horizon_bak = install_path_exists(HORIZON_OC_UPDATE_BACKUP_INI);
install_check_and_clear_screen_if_needed();
install_set_color(COLOR_YELLOW);
gfx_printf("HorizonOC: Stelle config.ini wieder her...\n");
install_set_color(COLOR_WHITE);
res = restore_horizon_oc_config_after_oc_update();
if (res != FR_OK)
return res;
install_set_color(COLOR_GREEN);
if (had_horizon_bak)
gfx_printf(" [OK] Deine HorizonOC-Einstellungen wurden wiederhergestellt.\n");
else
gfx_printf(" [OK] Keine fruehere config.ini — Standard aus dem Paket bleibt.\n");
install_set_color(COLOR_WHITE);
res = cleanup_horizon_oc_update_backup();
if (res != FR_OK)
return res;
}
install_check_and_clear_screen_if_needed();
// Remove staging directory (installed pack)
res = cleanup_staging_directory(pack_variant);