working recovery image!
diff --git a/install.c b/install.c
index 3a37b4a..5768960 100644
--- a/install.c
+++ b/install.c
@@ -106,7 +106,7 @@
const ZipEntry* binary_entry =
mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);
if (binary_entry == NULL) {
- return INSTALL_UPDATE_BINARY_MISSING;
+ return INSTALL_ERROR;
}
char* binary = "/tmp/update_binary";
@@ -242,17 +242,21 @@
// Update should take the rest of the progress bar.
ui_print("Installing update...\n");
- int result = try_update_binary(path, zip);
- if (result == INSTALL_UPDATE_BINARY_MISSING)
- {
- 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);
- result = handle_update_script(zip, script_entry);
+ // 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)
+ {
+ result = try_update_binary(path, zip);
+ }
+
register_package_root(NULL, NULL); // Unregister package root
return result;
}