From cfb63ae2b11dc5b9a7e0231a489131523114e7de Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Wed, 19 Sep 2012 14:30:17 -0400 Subject: Improve adb sideload -- add cancel Also copy zip from /tmp to storage and remove from /tmp to prevent running out of RAM. --- adb_install.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'adb_install.cpp') diff --git a/adb_install.cpp b/adb_install.cpp index 12bce1cca..f5ba89c3f 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -33,6 +33,7 @@ extern "C" { #include "minadbd/adb.h" #include "twinstall.h" +#include "data.h" int TWinstall_zip(const char* path, int* wipe_cache); } @@ -86,6 +87,7 @@ apply_from_adb(RecoveryUI* ui_, int* wipe_cache, const char* install_file) { execl("/sbin/recovery", "recovery", "--adbd", NULL); _exit(-1); } + DataManager_SetIntValue("tw_child_pid", child); int status; // TODO(dougz): there should be a way to cancel waiting for a // package (by pushing some button combo on the device). For now @@ -108,5 +110,17 @@ apply_from_adb(RecoveryUI* ui_, int* wipe_cache, const char* install_file) { } return INSTALL_ERROR; } - return TWinstall_zip(ADB_SIDELOAD_FILENAME, wipe_cache); + char zip_file[255]; + if (strncmp(ADB_SIDELOAD_FILENAME, "/tmp", 4) == 0) { + char command[255]; + sprintf(zip_file, "%s/%s", DataManager_GetCurrentStoragePath(), "sideload.zip"); + ui->Print("Copying zip to '%s'\n", zip_file); + sprintf(command, "cp %s %s", ADB_SIDELOAD_FILENAME, zip_file); + system(command); + sprintf(command, "rm %s", ADB_SIDELOAD_FILENAME); + system(command); + } else { + strcpy(zip_file, ADB_SIDELOAD_FILENAME); + } + return TWinstall_zip(zip_file, wipe_cache); } -- cgit v1.2.3