Allow selective restore from ROM Manager. Dump recovery image on Nandroid.

This commit is contained in:
Koushik K. Dutta 2010-03-29 14:46:00 -07:00
parent 6a26e7c23f
commit 6923cc3223
2 changed files with 23 additions and 5 deletions

View File

@ -806,12 +806,24 @@ cmd_restore_rom(const char *name, void *cookie, int argc, const char *argv[],
UNUSED(cookie);
CHECK_WORDS();
if (argc != 1) {
LOGE("Command %s requires exactly one argument\n", name);
return 1;
int restoreboot = 1;
int restoresystem = 1;
int restoredata = 1;
int restorecache = 1;
int i;
for (i = 0; i < argc; i++)
{
if (strcmp(argv[i], "noboot") == 0)
restoreboot = 0;
else if (strcmp(argv[i], "nosystem") == 0)
restoresystem = 0;
else if (strcmp(argv[i], "nodata") == 0)
restoredata = 0;
else if (strcmp(argv[i], "nocache") == 0)
restorecache = 0;
}
return nandroid_restore(argv[0], 1, 1, 1, 1);
return nandroid_restore(argv[0], restoreboot, restoresystem, restoredata, restorecache);
}
static int

View File

@ -122,7 +122,13 @@ int nandroid_backup(char* backup_path)
ret = dump_image("boot", tmp, NULL);
if (0 != ret)
return print_and_error("Error while dumping boot image!\n");
ui_print("Backing up recovery...\n");
sprintf(tmp, "%s/%s", backup_path, "recovery.img");
ret = dump_image("recovery", tmp, NULL);
if (0 != ret)
return print_and_error("Error while dumping boot image!\n");
if (0 != (ret = nandroid_backup_partition(backup_path, "SYSTEM:", "system")))
return ret;