void write_fstab_root(char *path, FILE *file) { Volume *vol = volume_for_path(path); if (vol == NULL) { LOGW("Unable to get recovery.fstab info for %s during fstab generation!\n", path); return; } char device[200]; if (vol->device[0] != '/') get_partition_device(vol->device, device); else strcpy(device, vol->device); fprintf(file, "%s ", device); fprintf(file, "%s ", path); // special case rfs cause auto will mount it as vfat on samsung. fprintf(file, "%s rw\n", vol->fs_type2 != NULL && strcmp(vol->fs_type, "rfs") != 0 ? "auto" : vol->fs_type); }
void show_nandroid_advanced_restore_menu(const char* path) { if (ensure_path_mounted(path) != 0) { LOGE ("Can't mount sdcard\n"); return; } static char* advancedheaders[] = { "Choose an image to restore", "", "Choose an image to restore", "first. The next menu will", "show you more options.", "", NULL }; char tmp[PATH_MAX]; sprintf(tmp, "%s/clockworkmod/backup/", path); char* file = choose_file_menu(tmp, NULL, advancedheaders); if (file == NULL) return; static char* headers[] = { "Advanced Restore", "", NULL }; static char* list[] = { "Restore boot", "Restore system", "Restore data", "Restore cache", "Restore sd-ext", "Restore wimax", NULL }; if (0 != get_partition_device("wimax", tmp)) { // disable wimax restore option list[5] = NULL; } static char* confirm_restore = "Confirm restore?"; int chosen_item = get_menu_selection(headers, list, 0, 0); switch (chosen_item) { case 0: if (confirm_selection(confirm_restore, "Yes - Restore boot")) nandroid_restore(file, 1, 0, 0, 0, 0, 0); break; case 1: if (confirm_selection(confirm_restore, "Yes - Restore system")) nandroid_restore(file, 0, 1, 0, 0, 0, 0); break; case 2: if (confirm_selection(confirm_restore, "Yes - Restore data")) nandroid_restore(file, 0, 0, 1, 0, 0, 0); break; case 3: if (confirm_selection(confirm_restore, "Yes - Restore cache")) nandroid_restore(file, 0, 0, 0, 1, 0, 0); break; case 4: if (confirm_selection(confirm_restore, "Yes - Restore sd-ext")) nandroid_restore(file, 0, 0, 0, 0, 1, 0); break; case 5: if (confirm_selection(confirm_restore, "Yes - Restore wimax")) nandroid_restore(file, 0, 0, 0, 0, 0, 1); break; } }
void show_nandroid_advanced_restore_menu(const char* volume) { if (ensure_path_mounted(volume) != 0) { LOGE ("Can't mount %s\n", volume); return; } static char* advancedheaders[] = { "Choose an image to restore", "", "Choose an image to restore", "first. The next menu will", "give you more options.", "", NULL }; char backup_path[PATH_MAX]; sprintf(backup_path, "%s/clockworkmod/backup/", volume); char* file = choose_file_menu(backup_path, NULL, advancedheaders); if (file == NULL) return; static char* headers[] = { "Nandroid Advanced Restore", "", NULL }; char* list[] = { "Restore boot", "Restore system", "Restore data", "Restore cache", "Restore sd-ext", "Restore wimax", "Restore webtop", "Restore PDS", NULL }; int num_menu_items = 8; int webtop = 6, pds = 7; int webtop_offset = 0, pds_offset = 0; int i; char tmp[PATH_MAX]; if (0 != get_partition_device("wimax", tmp)) { // disable wimax restore option list[5] = NULL; webtop_offset--; pds_offset--; } if (volume_for_path("/osh") == NULL) { // disable webtop restore option list[6] = NULL; pds_offset--; } if (volume_for_path("/pds") == NULL) { // disable PDS restore option list[7] = NULL; } for (i = 5; i < num_menu_items; i++) if ((list[i] == NULL) && (list[i+1] != NULL)) { list[i] = list[i+1]; list[i+1] = NULL; } static char* confirm_restore = "Confirm restore?"; int chosen_item = get_menu_selection(headers, list, 0, 0); if ((chosen_item >= 0) && (chosen_item <= 4)) { switch (chosen_item) { case 0: if (confirm_selection(confirm_restore, "Yes - Restore boot")) nandroid_restore(file, 1, 0, 0, 0, 0, 0, 0, 0); break; case 1: if (confirm_selection(confirm_restore, "Yes - Restore system")) nandroid_restore(file, 0, 1, 0, 0, 0, 0, 0, 0); break; case 2: if (confirm_selection(confirm_restore, "Yes - Restore data")) nandroid_restore(file, 0, 0, 1, 0, 0, 0, 0, 0); break; case 3: if (confirm_selection(confirm_restore, "Yes - Restore cache")) nandroid_restore(file, 0, 0, 0, 1, 0, 0, 0, 0); break; case 4: if (confirm_selection(confirm_restore, "Yes - Restore sd-ext")) nandroid_restore(file, 0, 0, 0, 0, 1, 0, 0, 0); break; } } else if ((webtop_offset == 0) && (pds_offset == 0) && (chosen_item >= 5) && (chosen_item <= 7)) { switch (chosen_item) { case 5: if (confirm_selection(confirm_restore, "Yes - Restore wimax")) nandroid_restore(file, 0, 0, 0, 0, 0, 1, 0, 0); break; case 6: if (confirm_selection(confirm_restore, "Yes - Restore webtop")) nandroid_restore(file, 0, 0, 0, 0, 0, 0, 1, 0); break; case 7: if (confirm_selection(confirm_restore, "Yes - Restore PDS")) nandroid_restore(file, 0, 0, 0, 0, 0, 0, 0, 1); break; } } else if ((chosen_item >= 5) && (chosen_item < 7)) { if (chosen_item == (pds + pds_offset)) { if (confirm_selection(confirm_restore, "Yes - Restore PDS")) nandroid_restore(file, 0, 0, 0, 0, 0, 0, 0, 1); } else if (chosen_item == (webtop + webtop_offset)) { if (confirm_selection(confirm_restore, "Yes - Restore webtop")) nandroid_restore(file, 0, 0, 0, 0, 0, 0, 1, 0); } } }
void show_nandroid_advanced_restore_menu() { const char* sdcard_path; char* backup_path[PATH_MAX]; if (target_sdcard == TARGET_INTERNAL_SDCARD) { sdcard_path = INTERNAL_SDCARD_PATH; } else { sdcard_path = EXTERNAL_SDCARD_PATH; } if (ensure_path_mounted(sdcard_path) != 0) { LOGE ("Can't mount %s\n", sdcard_path); return; } static char* advancedheaders[] = { "Choose an image to restore", "", "Choose an image to restore", "first. The next menu will", "you more options.", "", NULL }; sprintf(backup_path, "%s/clockworkmod/backup/", sdcard_path); char* file = choose_file_menu(backup_path, NULL, advancedheaders); if (file == NULL) return; static char* headers[] = { "Nandroid Advanced Restore", "", NULL }; static char* list[] = { "Restore boot", "Restore system", "Restore data", "Restore cache", #ifdef RECOVERY_HAVE_SD_EXT "Restore sd-ext", #endif "Restore wimax", NULL }; char tmp[PATH_MAX]; if (0 != get_partition_device("wimax", tmp)) { // disable wimax restore option list[5] = NULL; } static char* confirm_restore = "Confirm restore?"; int chosen_item = get_menu_selection(headers, list, 0, 0); switch (chosen_item) { case 0: if (confirm_selection(confirm_restore, "Yes - Restore boot")) nandroid_restore(file, 1, 0, 0, 0, 0, 0); break; case 1: if (confirm_selection(confirm_restore, "Yes - Restore system")) nandroid_restore(file, 0, 1, 0, 0, 0, 0); break; case 2: if (confirm_selection(confirm_restore, "Yes - Restore data")) nandroid_restore(file, 0, 0, 1, 0, 0, 0); break; case 3: if (confirm_selection(confirm_restore, "Yes - Restore cache")) nandroid_restore(file, 0, 0, 0, 1, 0, 0); break; #ifdef RECOVERY_HAVE_SD_EXT case 4: if (confirm_selection(confirm_restore, "Yes - Restore sd-ext")) nandroid_restore(file, 0, 0, 0, 0, 1, 0); break; case 5: #else case 4: #endif if (confirm_selection(confirm_restore, "Yes - Restore wimax")) nandroid_restore(file, 0, 0, 0, 0, 0, 1); break; } }
void show_nandroid_advanced_restore_menu(const char* path) { if (ensure_path_mounted(path) != 0) { LOGE ("无法挂载 sdcard\n"); return; } static char* advancedheaders[] = { "选择恢复镜像", "", "先选择一个需要恢复的镜像", "下级菜单", "将会显示更多选项", "", NULL }; char tmp[PATH_MAX]; sprintf(tmp, "%s/clockworkmod/backup/", path); char* file = choose_file_menu(tmp, NULL, advancedheaders); if (file == NULL) return; static char* headers[] = { "高级恢复", "", NULL }; static char* list[] = { "恢复 boot", "恢复 system", "恢复 data", "恢复 cache", "恢复 sd-ext", "恢复 wimax", NULL }; if (0 != get_partition_device("wimax", tmp)) { // disable wimax restore option list[5] = NULL; } static char* confirm_restore = "确认恢复?"; int chosen_item = get_menu_selection(headers, list, 0, 0); switch (chosen_item) { case 0: if (confirm_selection(confirm_restore, "是 - 恢复 boot")) nandroid_restore(file, 1, 0, 0, 0, 0, 0); break; case 1: if (confirm_selection(confirm_restore, "是 - 恢复 system")) nandroid_restore(file, 0, 1, 0, 0, 0, 0); break; case 2: if (confirm_selection(confirm_restore, "是 - 恢复 data")) nandroid_restore(file, 0, 0, 1, 0, 0, 0); break; case 3: if (confirm_selection(confirm_restore, "是 - 恢复 cache")) nandroid_restore(file, 0, 0, 0, 1, 0, 0); break; case 4: if (confirm_selection(confirm_restore, "是 - 恢复 sd-ext")) nandroid_restore(file, 0, 0, 0, 0, 1, 0); break; case 5: if (confirm_selection(confirm_restore, "是 - 恢复 wimax")) nandroid_restore(file, 0, 0, 0, 0, 0, 1); break; } }