run update-binary first. revert recovery API version to 2. use RECOVERY_VERSION for the actual display version.

This commit is contained in:
Koushik K. Dutta 2010-03-20 01:08:55 -07:00
parent a496b51a83
commit 581bd861d1
4 changed files with 22 additions and 14 deletions

View File

@ -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.

View File

@ -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

View File

@ -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_

View File

@ -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);