void show_nandroid_menu() { static char* headers[] = { "Nandroid", "", NULL }; static char* list[] = { "~~~> Go Back <~~~", "Backup", "Restore", "Advanced Backup", "Advanced Restore", NULL }; for (;;) { int chosen_item = get_menu_selection(headers, list, 0); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { return; break; } case 1: { char backup_path[PATH_MAX]; time_t t = time(NULL); struct tm *tmp = localtime(&t); if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); sprintf(backup_path, "/sdcard/clockworkmod/backup/%d", tp.tv_sec); } else { strftime(backup_path, sizeof(backup_path), "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp); } nandroid_backup(backup_path); break; } case 2: show_nandroid_restore_menu(); break; case 3: show_nandroid_advanced_backup_menu(); break; case 4: show_nandroid_advanced_restore_menu(); break; } } }
void show_nandroid_menu() { static char* headers[] = { "Nandroid", "", NULL }; static char* list[] = { "Backup", "Restore", "Advanced Restore", NULL }; int chosen_item = get_menu_selection(headers, list, 0); switch (chosen_item) { case 0: { char backup_path[PATH_MAX]; time_t t = time(NULL); struct tm *tmp = localtime(&t); if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); sprintf(backup_path, "/sdcard/ebrecovery/backup/%d", tp.tv_sec); } else { strftime(backup_path, sizeof(backup_path), "/sdcard/ebrecovery/backup/%F.%H.%M.%S", tmp); } nandroid_backup(backup_path); } break; case 1: show_nandroid_restore_menu(); break; case 2: show_nandroid_advanced_restore_menu(1); break; } }
void show_nandroid_menu() { static char* headers[] = { "Backup and Restore", "", NULL }; char* list[] = { "backup", "restore", "delete", "advanced restore", "free unused backup data", "choose default backup format", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; char *other_sd = NULL; if (volume_for_path("/emmc") != NULL) { other_sd = "/emmc"; list[6] = "backup to internal sdcard"; list[7] = "restore from internal sdcard"; list[8] = "advanced restore from internal sdcard"; list[9] = "delete from internal sdcard"; } else if (volume_for_path("/external_sd") != NULL) { other_sd = "/external_sd"; list[6] = "backup to external sdcard"; list[7] = "restore from external sdcard"; list[8] = "advanced restore from external sdcard"; list[9] = "delete from external sdcard"; } #ifdef RECOVERY_EXTEND_NANDROID_MENU extend_nandroid_menu(list, 10, sizeof(list) / sizeof(char*)); #endif for (;;) { int chosen_item = get_filtered_menu_selection(headers, list, 0, 0, sizeof(list) / sizeof(char*)); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { char backup_path[PATH_MAX]; time_t t = time(NULL); struct tm *tmp = localtime(&t); if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); sprintf(backup_path, "/sdcard/clockworkmod/backup/%d", tp.tv_sec); } else { strftime(backup_path, sizeof(backup_path), "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp); } nandroid_backup(backup_path); write_recovery_version(); } break; case 1: show_nandroid_restore_menu("/sdcard"); write_recovery_version(); break; case 2: show_nandroid_delete_menu("/sdcard"); write_recovery_version(); break; case 3: show_nandroid_advanced_restore_menu("/sdcard"); write_recovery_version(); break; case 4: run_dedupe_gc(other_sd); break; case 5: choose_default_backup_format(); break; case 6: { char backup_path[PATH_MAX]; time_t t = time(NULL); struct tm *timeptr = localtime(&t); if (timeptr == NULL) { struct timeval tp; gettimeofday(&tp, NULL); if (other_sd != NULL) { sprintf(backup_path, "%s/clockworkmod/backup/%d", other_sd, tp.tv_sec); } else { break; } } else { if (other_sd != NULL) { char tmp[PATH_MAX]; strftime(tmp, sizeof(tmp), "clockworkmod/backup/%F.%H.%M.%S", timeptr); // this sprintf results in: // /emmc/clockworkmod/backup/%F.%H.%M.%S (time values are populated too) sprintf(backup_path, "%s/%s", other_sd, tmp); } else { break; } } nandroid_backup(backup_path); } break; case 7: if (other_sd != NULL) { show_nandroid_restore_menu(other_sd); } break; case 8: if (other_sd != NULL) { show_nandroid_advanced_restore_menu(other_sd); } break; case 9: if (other_sd != NULL) { show_nandroid_delete_menu(other_sd); } break; default: #ifdef RECOVERY_EXTEND_NANDROID_MENU handle_nandroid_menu(10, chosen_item); #endif break; } } }
void show_nandroid_menu() { static char* headers[] = { "Nandroid", "", NULL }; static char* list[] = { "Backup", "Restore", "Advanced Restore", NULL }; #ifdef BOARD_HAS_SDCARD_INTERNAL int chosen_sdcard = -1; #endif int chosen_item = get_menu_selection(headers, list, 0, 0); switch (chosen_item) { case 0: { char backup_path[PATH_MAX]; char final_path[PATH_MAX]; time_t t = time(NULL); struct tm *tmp = localtime(&t); #ifdef BOARD_HAS_SDCARD_INTERNAL chosen_sdcard = show_sdcard_selection_menu(); if (chosen_sdcard > -1) { switch (chosen_sdcard) { case 0: sprintf(backup_path, "/sdcard"); break; case 1: sprintf(backup_path, "/sdcard-ext"); break; } } else break; #else sprintf(backup_path, "/sdcard"); #endif #ifdef BOARD_HAS_WEBTOP static char* header[] = { "Include webtop in backup?", "", NULL }; static char* item[] = { "Yes", "No", NULL }; int skip_webtop = get_menu_selection(header, item, 0, 0); if (skip_webtop == GO_BACK) { return; } #endif if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); sprintf(final_path, "%s/clockworkmod/backup/%d", backup_path, tp.tv_sec); } else { char tmp_path[PATH_MAX]; strftime(tmp_path, sizeof(tmp_path), "clockworkmod/backup/%F.%H.%M.%S", tmp); sprintf(final_path, "%s/%s", backup_path, tmp_path); } nandroid_backup(final_path, backup_path, skip_webtop); } break; case 1: #ifdef BOARD_HAS_SDCARD_INTERNAL chosen_sdcard = show_sdcard_selection_menu(); if (chosen_sdcard > -1) { switch (chosen_sdcard) { case 0: show_nandroid_restore_menu("/sdcard"); break; case 1: show_nandroid_restore_menu("/sdcard-ext"); break; } } else break; #else show_nandroid_restore_menu("/sdcard"); #endif break; case 2: #ifdef BOARD_HAS_SDCARD_INTERNAL chosen_sdcard = show_sdcard_selection_menu(); if (chosen_sdcard > -1) { switch (chosen_sdcard) { case 0: show_nandroid_advanced_restore_menu("/sdcard"); break; case 1: show_nandroid_advanced_restore_menu("/sdcard-ext"); break; } } else break; #else show_nandroid_advanced_restore_menu("/sdcard"); #endif break; } }
void show_nandroid_menu() { static char* headers[] = { "Nandroid", "", NULL }; static char* list[] = { "backup to internal sdcard", "restore from internal sdcard", "advanced restore from internal sdcard", "backup to external sdcard", "restore from external sdcard", "advanced restore from external sdcard", NULL }; if (volume_for_path("/emmc") == NULL || volume_for_path("/sdcard") == NULL && is_data_media()) list[3] = NULL; int chosen_item = get_menu_selection(headers, list, 0, 0); switch (chosen_item) { case 0: { char backup_path[PATH_MAX]; time_t t = time(NULL); struct tm *tmp = localtime(&t); if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); sprintf(backup_path, "/emmc/clockworkmod/backup/%d", tp.tv_sec); } else { strftime(backup_path, sizeof(backup_path), "/emmc/clockworkmod/backup/%F.%H.%M.%S", tmp); } nandroid_backup(backup_path); } break; case 1: show_nandroid_restore_menu("/emmc"); break; case 2: show_nandroid_advanced_restore_menu("/emmc"); break; case 3: { char backup_path[PATH_MAX]; time_t t = time(NULL); struct tm *tmp = localtime(&t); if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); sprintf(backup_path, "/sdcard/clockworkmod/backup/%d", tp.tv_sec); } else { strftime(backup_path, sizeof(backup_path), "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp); } nandroid_backup(backup_path); } break; case 4: show_nandroid_restore_menu("/sdcard"); break; case 5: show_nandroid_advanced_restore_menu("/sdcard"); break; } }
void show_nandroid_menu() { static char* headers[] = { "Nandroid", "", NULL }; static char* list_internal[] = { "Backup to internal sdcard", "Restore from internal sdcard", "Advanced Restore from internal sdcard", "toggle target sdcard", NULL }; static char* list_external[] = { "Backup to external sdcard", "Restore from external sdcard", "Advanced Restore from external sdcard", "toggle target sdcard", NULL }; for (;;) { char* list; if (target_sdcard == TARGET_INTERNAL_SDCARD) { list = list_internal; } else { list = list_external; } int chosen_item = get_menu_selection(headers, list, 0, 0); switch (chosen_item) { case 0: { char backup_path[PATH_MAX]; #ifdef RECOVERY_TZ_JPN time_t t = time(NULL) + (60 * 60 * 9); // add 9 hours #else time_t t = time(NULL); #endif struct tm *tmp = localtime(&t); if (tmp == NULL) { struct timeval tp; gettimeofday(&tp, NULL); if (target_sdcard == TARGET_INTERNAL_SDCARD) { sprintf(backup_path, INTERNAL_SDCARD_PATH "/clockworkmod/backup/%d", tp.tv_sec); } else { sprintf(backup_path, EXTERNAL_SDCARD_PATH "/clockworkmod/backup/%d", tp.tv_sec); } } else { if (target_sdcard == TARGET_INTERNAL_SDCARD) { strftime(backup_path, sizeof(backup_path), INTERNAL_SDCARD_PATH "/clockworkmod/backup/%F.%H.%M.%S", tmp); } else { strftime(backup_path, sizeof(backup_path), EXTERNAL_SDCARD_PATH "/clockworkmod/backup/%F.%H.%M.%S", tmp); } } nandroid_backup(backup_path); } return; case 1: show_nandroid_restore_menu(); break; case 2: show_nandroid_advanced_restore_menu(); break; case 3: toggle_targer_sdcard(); break; default: return; } } }