refactor: clean install backup — dbi.config and prod.keys only
- Backup/restore DBI settings file instead of whole DBI folder - Remove Tinfoil folder backup/restore - Adjust deletion_lists_clean.h comments; UI strings in install_clean.c Made-with: Cursor
This commit is contained in:
@@ -24,17 +24,9 @@ int backup_user_data(void) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup DBI if it exists
|
// Backup DBI settings file only (not .nro installers)
|
||||||
if (path_exists("sd:/switch/DBI")) {
|
if (path_exists(DBI_CONFIG_PATH)) {
|
||||||
res = folder_copy("sd:/switch/DBI", TEMP_BACKUP_PATH);
|
res = file_copy(DBI_CONFIG_PATH, TEMP_BACKUP_DBI_CONFIG);
|
||||||
if (res != FR_OK) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Backup Tinfoil if it exists
|
|
||||||
if (path_exists("sd:/switch/tinfoil")) {
|
|
||||||
res = folder_copy("sd:/switch/tinfoil", TEMP_BACKUP_PATH);
|
|
||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -61,25 +53,15 @@ int restore_user_data(void) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore DBI if backup exists
|
// Restore DBI settings if backed up
|
||||||
if (path_exists("sd:/temp_backup/DBI")) {
|
if (path_exists(TEMP_BACKUP_DBI_CONFIG)) {
|
||||||
res = folder_copy("sd:/temp_backup/DBI", "sd:/switch");
|
res = f_mkdir("sd:/switch/DBI");
|
||||||
if (res == FR_OK) {
|
if (res != FR_OK && res != FR_EXIST) {
|
||||||
// Delete old DBI .nro files
|
return res;
|
||||||
f_unlink("sd:/switch/DBI/DBI_810_EN.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI_810_DE.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI_845_EN.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI_845_DE.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI.nro");
|
|
||||||
}
|
}
|
||||||
}
|
res = file_copy(TEMP_BACKUP_DBI_CONFIG, DBI_CONFIG_PATH);
|
||||||
|
if (res != FR_OK) {
|
||||||
// Restore Tinfoil if backup exists
|
return res;
|
||||||
if (path_exists("sd:/temp_backup/tinfoil")) {
|
|
||||||
res = folder_copy("sd:/temp_backup/tinfoil", "sd:/switch");
|
|
||||||
if (res == FR_OK) {
|
|
||||||
// Delete old tinfoil.nro
|
|
||||||
f_unlink("sd:/switch/tinfoil/tinfoil.nro");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
#include <utils/types.h>
|
#include <utils/types.h>
|
||||||
|
|
||||||
#define TEMP_BACKUP_PATH "sd:/temp_backup"
|
#define TEMP_BACKUP_PATH "sd:/temp_backup"
|
||||||
|
/** DBI settings; preserved across clean install (not whole DBI folder). */
|
||||||
|
#define DBI_CONFIG_PATH "sd:/switch/DBI/dbi.config"
|
||||||
|
#define TEMP_BACKUP_DBI_CONFIG TEMP_BACKUP_PATH "/dbi.config"
|
||||||
|
|
||||||
/** Live HorizonOC settings (Overclock tool). */
|
/** Live HorizonOC settings (Overclock tool). */
|
||||||
#define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini"
|
#define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini"
|
||||||
@@ -14,7 +17,7 @@
|
|||||||
#define HORIZON_OC_UPDATE_BACKUP_DIR "sd:/.omninx_oc_update"
|
#define HORIZON_OC_UPDATE_BACKUP_DIR "sd:/.omninx_oc_update"
|
||||||
#define HORIZON_OC_UPDATE_BACKUP_INI HORIZON_OC_UPDATE_BACKUP_DIR "/config.ini"
|
#define HORIZON_OC_UPDATE_BACKUP_INI HORIZON_OC_UPDATE_BACKUP_DIR "/config.ini"
|
||||||
|
|
||||||
// Backup user data (DBI, Tinfoil, prod.keys) before clean install
|
// Backup user data (DBI dbi.config, prod.keys) before clean install
|
||||||
int backup_user_data(void);
|
int backup_user_data(void);
|
||||||
|
|
||||||
// Restore user data after clean install
|
// Restore user data after clean install
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
* OmniNX Installer - Deletion Lists for Clean Install Mode
|
* OmniNX Installer - Deletion Lists for Clean Install Mode
|
||||||
* Deletion policy aligned with NiklasCFW pack clean install (TegraExplorer script):
|
* Deletion policy aligned with NiklasCFW pack clean install (TegraExplorer script):
|
||||||
* full sd:/atmosphere, bootloader/config subsets, sd:/switch, root + misc, then
|
* full sd:/atmosphere, bootloader/config subsets, sd:/switch, root + misc, then
|
||||||
* post-restore paths (e.g. tinfoil db). Backup/restore of DBI, Tinfoil, prod.keys
|
* post-restore paths (e.g. tinfoil db). DBI/prod.keys backup is in backup.c.
|
||||||
* is implemented in backup.c, not here.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -114,7 +113,7 @@ static const char* clean_misc_files_to_delete[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// After DBI/Tinfoil/prod.keys restore (NiklasCFW: deldir("sd:/switch/tinfoil/db"))
|
// After DBI/prod.keys restore (NiklasCFW: deldir("sd:/switch/tinfoil/db"))
|
||||||
static const char* clean_post_restore_dirs_to_delete[] = {
|
static const char* clean_post_restore_dirs_to_delete[] = {
|
||||||
"sd:/switch/tinfoil/db",
|
"sd:/switch/tinfoil/db",
|
||||||
NULL
|
NULL
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
// Clean mode: Backup user data
|
// Clean mode: Backup user data
|
||||||
int clean_mode_backup(void) {
|
int clean_mode_backup(void) {
|
||||||
set_color(COLOR_CYAN);
|
set_color(COLOR_CYAN);
|
||||||
gfx_printf(" Sichere: DBI, Tinfoil, prod.keys\n");
|
gfx_printf(" Sichere: DBI (dbi.config), prod.keys\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
int res = backup_user_data();
|
int res = backup_user_data();
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
@@ -95,7 +95,7 @@ int clean_mode_wipe(void) {
|
|||||||
// Clean mode: Restore user data
|
// Clean mode: Restore user data
|
||||||
int clean_mode_restore(void) {
|
int clean_mode_restore(void) {
|
||||||
set_color(COLOR_CYAN);
|
set_color(COLOR_CYAN);
|
||||||
gfx_printf(" Stelle wieder her: DBI, Tinfoil, prod.keys\n");
|
gfx_printf(" Stelle wieder her: DBI (dbi.config), prod.keys\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
int res = restore_user_data();
|
int res = restore_user_data();
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user