Skip to content

Commit 581bd86

Browse files
committedMar 20, 2010
run update-binary first. revert recovery API version to 2. use RECOVERY_VERSION for the actual display version.
1 parent a496b51 commit 581bd86

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed
 

‎Android.mk

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ LOCAL_MODULE := recovery
2626

2727
LOCAL_FORCE_STATIC_EXECUTABLE := true
2828

29-
RECOVERY_API_VERSION := 1.7.3
29+
RECOVERY_VERSION := ClockworkMod Recovery v1.7.5
30+
LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
31+
RECOVERY_API_VERSION := 2
3032
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
3133

3234
# This binary is in the recovery ramdisk, which is otherwise a copy of root.

‎install.c

+16-9
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ try_update_binary(const char *path, ZipArchive *zip) {
106106
const ZipEntry* binary_entry =
107107
mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);
108108
if (binary_entry == NULL) {
109-
return INSTALL_ERROR;
109+
return INSTALL_UPDATE_BINARY_MISSING;
110110
}
111111

112112
char* binary = "/tmp/update_binary";
@@ -242,19 +242,26 @@ handle_update_package(const char *path, ZipArchive *zip)
242242
// Update should take the rest of the progress bar.
243243
ui_print("Installing update...\n");
244244

245-
// Try installing via the update-script first, because we
246-
// have more control over the asserts it may contain.
247-
// If it does not exist, try the update-binary.
248245
if (register_package_root(zip, path) < 0) {
249246
LOGE("Can't register package root\n");
250247
return INSTALL_ERROR;
251248
}
252-
const ZipEntry *script_entry;
253-
script_entry = find_update_script(zip);
254-
int result = handle_update_script(zip, script_entry);
255-
if (result == INSTALL_UPDATE_SCRIPT_MISSING)
249+
LOGI("Trying update-binary.\n");
250+
int result = try_update_binary(path, zip);
251+
252+
if (result == INSTALL_UPDATE_BINARY_MISSING)
256253
{
257-
result = try_update_binary(path, zip);
254+
register_package_root(NULL, NULL); // Unregister package root
255+
if (register_package_root(zip, path) < 0) {
256+
LOGE("Can't register package root\n");
257+
return INSTALL_ERROR;
258+
}
259+
const ZipEntry *script_entry;
260+
script_entry = find_update_script(zip);
261+
LOGI("Trying update-script.\n");
262+
result = handle_update_script(zip, script_entry);
263+
if (result == INSTALL_UPDATE_SCRIPT_MISSING)
264+
result = INSTALL_ERROR;
258265
}
259266

260267
register_package_root(NULL, NULL); // Unregister package root

‎install.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "common.h"
2121

22-
enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_UPDATE_SCRIPT_MISSING };
22+
enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_UPDATE_SCRIPT_MISSING, INSTALL_UPDATE_BINARY_MISSING };
2323
int install_package(const char *root_path);
2424

2525
#endif // RECOVERY_INSTALL_H_

‎recovery.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,7 @@ erase_root(const char *root)
284284

285285
static char**
286286
prepend_title(char** headers) {
287-
char* title[] = { "ClockworkMod Recovery v"
288-
EXPAND(RECOVERY_API_VERSION),
287+
char* title[] = { EXPAND(RECOVERY_VERSION),
289288
"",
290289
NULL };
291290

@@ -393,7 +392,7 @@ static void
393392
prompt_and_wait()
394393
{
395394
char** headers = prepend_title(MENU_HEADERS);
396-
ui_print("ClockworkMod Recovery v"EXPAND(RECOVERY_API_VERSION)"\n");
395+
ui_print(EXPAND(RECOVERY_VERSION)"\n");
397396

398397
for (;;) {
399398
finish_recovery(NULL);

0 commit comments

Comments
 (0)