copy extended command and run it, rather than load and delete.
This commit is contained in:
parent
7c17e8828c
commit
6771aca715
@ -26,7 +26,7 @@ LOCAL_MODULE := recovery
|
||||
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
|
||||
RECOVERY_VERSION := ClockworkMod Recovery v1.8.0.5
|
||||
RECOVERY_VERSION := ClockworkMod Recovery v1.8.0.6
|
||||
LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
|
||||
RECOVERY_API_VERSION := 2
|
||||
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
|
||||
|
@ -569,7 +569,7 @@ int run_script_from_buffer(char* script_data, int script_len, char* filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int run_script(char* filename, int delete_file)
|
||||
int run_script(char* filename)
|
||||
{
|
||||
struct stat file_info;
|
||||
if (0 != stat(filename, &file_info)) {
|
||||
@ -584,8 +584,6 @@ int run_script(char* filename, int delete_file)
|
||||
// supposedly not necessary, but let's be safe.
|
||||
script_data[script_len] = '\0';
|
||||
fclose(file);
|
||||
if (delete_file)
|
||||
remove(filename);
|
||||
|
||||
int ret = run_script_from_buffer(script_data, script_len, filename);
|
||||
free(script_data);
|
||||
@ -595,6 +593,10 @@ int run_script(char* filename, int delete_file)
|
||||
int run_and_remove_extendedcommand()
|
||||
{
|
||||
__system("touch /tmp/.installscript");
|
||||
char tmp[PATH_MAX];
|
||||
sprintf(tmp, "cp %s /tmp/%s", EXTENDEDCOMMAND_SCRIPT, basename(EXTENDEDCOMMAND_SCRIPT));
|
||||
__system(tmp);
|
||||
remove(EXTENDEDCOMMAND_SCRIPT);
|
||||
int i = 0;
|
||||
for (i = 20; i > 0; i--) {
|
||||
ui_print("Waiting for SD Card to mount (%ds)\n", i);
|
||||
@ -608,7 +610,8 @@ int run_and_remove_extendedcommand()
|
||||
ui_print("Timed out waiting for SD card... continuing anyways.");
|
||||
}
|
||||
|
||||
return run_script(EXTENDEDCOMMAND_SCRIPT, 1);
|
||||
sprintf(tmp, "/tmp/%s", basename(EXTENDEDCOMMAND_SCRIPT));
|
||||
return run_script(tmp);
|
||||
}
|
||||
|
||||
int amend_main(int argc, char** argv)
|
||||
@ -623,7 +626,7 @@ int amend_main(int argc, char** argv)
|
||||
if (register_update_commands(&ctx)) {
|
||||
LOGE("Can't install update commands\n");
|
||||
}
|
||||
return run_script(argv[1], 0);
|
||||
return run_script(argv[1]);
|
||||
}
|
||||
|
||||
void show_nandroid_advanced_restore_menu()
|
||||
|
11
nandroid.c
11
nandroid.c
@ -144,9 +144,16 @@ int nandroid_backup(char* backup_path)
|
||||
|
||||
struct stat st;
|
||||
if (0 != stat("/dev/block/mmcblk0p2", &st))
|
||||
{
|
||||
ui_print("No sd-ext found. Skipping backup of sd-ext.\n");
|
||||
else if (0 != (ret = ensure_root_path_mounted("SDEXT:")) || 0 != (ret = nandroid_backup_partition(backup_path, "SDEXT:")))
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != ensure_root_path_mounted("SDEXT:"))
|
||||
ui_print("Could not mount sd-ext. sd-ext backup may not be supported on this device. Skipping backup of sd-ext.");
|
||||
else if (0 != (ret = nandroid_backup_partition(backup_path, "SDEXT:")))
|
||||
return ret;
|
||||
}
|
||||
|
||||
ui_print("Generating md5 sum...\n");
|
||||
sprintf(tmp, "nandroid-md5.sh %s", backup_path);
|
||||
|
@ -541,6 +541,7 @@ main(int argc, char **argv)
|
||||
if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR;
|
||||
if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed.\n");
|
||||
} else {
|
||||
LOGI("Running extendedcommand...\n");
|
||||
status = INSTALL_ERROR; // No command specified
|
||||
// we are starting up in user initiated recovery here
|
||||
// let's set up some default options
|
||||
|
Loading…
Reference in New Issue
Block a user