@@ -106,7 +106,7 @@ try_update_binary(const char *path, ZipArchive *zip) {
106
106
const ZipEntry * binary_entry =
107
107
mzFindZipEntry (zip , ASSUMED_UPDATE_BINARY_NAME );
108
108
if (binary_entry == NULL ) {
109
- return INSTALL_ERROR ;
109
+ return INSTALL_UPDATE_BINARY_MISSING ;
110
110
}
111
111
112
112
char * binary = "/tmp/update_binary" ;
@@ -242,19 +242,26 @@ handle_update_package(const char *path, ZipArchive *zip)
242
242
// Update should take the rest of the progress bar.
243
243
ui_print ("Installing update...\n" );
244
244
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.
248
245
if (register_package_root (zip , path ) < 0 ) {
249
246
LOGE ("Can't register package root\n" );
250
247
return INSTALL_ERROR ;
251
248
}
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 )
256
253
{
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 ;
258
265
}
259
266
260
267
register_package_root (NULL , NULL ); // Unregister package root
0 commit comments