Improve adb sideload - use storage vs tmp
diff --git a/adb_install.cpp b/adb_install.cpp
index f5ba89c..3b64606 100644
--- a/adb_install.cpp
+++ b/adb_install.cpp
@@ -84,7 +84,7 @@
pid_t child;
if ((child = fork()) == 0) {
- execl("/sbin/recovery", "recovery", "--adbd", NULL);
+ execl("/sbin/recovery", "recovery", "--adbd", install_file, NULL);
_exit(-1);
}
DataManager_SetIntValue("tw_child_pid", child);
@@ -102,7 +102,7 @@
maybe_restart_adbd();
struct stat st;
- if (stat(ADB_SIDELOAD_FILENAME, &st) != 0) {
+ if (stat(install_file, &st) != 0) {
if (errno == ENOENT) {
ui->Print("No package received.\n");
} else {
@@ -110,17 +110,5 @@
}
return INSTALL_ERROR;
}
- 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);
+ return TWinstall_zip(install_file, wipe_cache);
}