aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--install.c25
-rw-r--r--install.h2
-rw-r--r--recovery.c5
4 files changed, 22 insertions, 14 deletions
diff --git a/Android.mk b/Android.mk
index f0f0e81..4143a5e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,7 +26,9 @@ LOCAL_MODULE := recovery
LOCAL_FORCE_STATIC_EXECUTABLE := true
-RECOVERY_API_VERSION := 1.7.3
+RECOVERY_VERSION := ClockworkMod Recovery v1.7.5
+LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
+RECOVERY_API_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
# This binary is in the recovery ramdisk, which is otherwise a copy of root.
diff --git a/install.c b/install.c
index 5768960..5291b5c 100644
--- a/install.c
+++ b/install.c
@@ -106,7 +106,7 @@ try_update_binary(const char *path, ZipArchive *zip) {
const ZipEntry* binary_entry =
mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);
if (binary_entry == NULL) {
- return INSTALL_ERROR;
+ return INSTALL_UPDATE_BINARY_MISSING;
}
char* binary = "/tmp/update_binary";
@@ -242,19 +242,26 @@ handle_update_package(const char *path, ZipArchive *zip)
// Update should take the rest of the progress bar.
ui_print("Installing update...\n");
- // Try installing via the update-script first, because we
- // have more control over the asserts it may contain.
- // If it does not exist, try the update-binary.
if (register_package_root(zip, path) < 0) {
LOGE("Can't register package root\n");
return INSTALL_ERROR;
}
- const ZipEntry *script_entry;
- script_entry = find_update_script(zip);
- int result = handle_update_script(zip, script_entry);
- if (result == INSTALL_UPDATE_SCRIPT_MISSING)
+ LOGI("Trying update-binary.\n");
+ int result = try_update_binary(path, zip);
+
+ if (result == INSTALL_UPDATE_BINARY_MISSING)
{
- result = try_update_binary(path, zip);
+ register_package_root(NULL, NULL); // Unregister package root
+ if (register_package_root(zip, path) < 0) {
+ LOGE("Can't register package root\n");
+ return INSTALL_ERROR;
+ }
+ const ZipEntry *script_entry;
+ script_entry = find_update_script(zip);
+ LOGI("Trying update-script.\n");
+ result = handle_update_script(zip, script_entry);
+ if (result == INSTALL_UPDATE_SCRIPT_MISSING)
+ result = INSTALL_ERROR;
}
register_package_root(NULL, NULL); // Unregister package root
diff --git a/install.h b/install.h
index 3ee814b..ec97d39 100644
--- a/install.h
+++ b/install.h
@@ -19,7 +19,7 @@
#include "common.h"
-enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_UPDATE_SCRIPT_MISSING };
+enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_UPDATE_SCRIPT_MISSING, INSTALL_UPDATE_BINARY_MISSING };
int install_package(const char *root_path);
#endif // RECOVERY_INSTALL_H_
diff --git a/recovery.c b/recovery.c
index 0464147..ef1aff4 100644
--- a/recovery.c
+++ b/recovery.c
@@ -284,8 +284,7 @@ erase_root(const char *root)
static char**
prepend_title(char** headers) {
- char* title[] = { "ClockworkMod Recovery v"
- EXPAND(RECOVERY_API_VERSION),
+ char* title[] = { EXPAND(RECOVERY_VERSION),
"",
NULL };
@@ -393,7 +392,7 @@ static void
prompt_and_wait()
{
char** headers = prepend_title(MENU_HEADERS);
- ui_print("ClockworkMod Recovery v"EXPAND(RECOVERY_API_VERSION)"\n");
+ ui_print(EXPAND(RECOVERY_VERSION)"\n");
for (;;) {
finish_recovery(NULL);