diff options
author | Koushik K. Dutta <koushd@gmail.com> | 2010-03-20 01:08:55 -0700 |
---|---|---|
committer | Koushik K. Dutta <koushd@gmail.com> | 2010-03-20 01:08:55 -0700 |
commit | 581bd861d18c60d244c88fea3fa62296f9aefd30 (patch) | |
tree | 3140616542f4f985271b5c8ff82b4eb797845a3c /install.c | |
parent | a496b51a83a9a6141fb0c9424597a905f1e7dc13 (diff) | |
download | bootable_recovery-581bd861d18c60d244c88fea3fa62296f9aefd30.zip bootable_recovery-581bd861d18c60d244c88fea3fa62296f9aefd30.tar.gz bootable_recovery-581bd861d18c60d244c88fea3fa62296f9aefd30.tar.bz2 |
run update-binary first. revert recovery API version to 2. use RECOVERY_VERSION for the actual display version.
Diffstat (limited to 'install.c')
-rw-r--r-- | install.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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 |