install_zip command

This commit is contained in:
Koushik K. Dutta 2010-03-08 02:58:04 -08:00
parent 19459f31fa
commit ea46fe29d9
3 changed files with 25 additions and 2 deletions

View File

@ -836,6 +836,21 @@ cmd_print(const char *name, void *cookie, int argc, const char *argv[],
return 0;
}
static int
cmd_install_zip(const char *name, void *cookie, int argc, const char *argv[],
PermissionRequestList *permissions)
{
UNUSED(cookie);
CHECK_WORDS();
if (argc != 1) {
LOGE("Command %s requires exactly one argument\n", name);
return 1;
}
return install_zip(argv[0]);
}
/*
* Function definitions
*/
@ -1211,6 +1226,9 @@ register_update_commands(RecoveryCommandContext *ctx)
ret = registerCommand("print", CMD_ARGS_WORDS, cmd_print, (void *)ctx);
if (ret < 0) return ret;
ret = registerCommand("install_zip", CMD_ARGS_WORDS, cmd_install_zip, (void *)ctx);
if (ret < 0) return ret;
/*
* Functions
*/

View File

@ -50,7 +50,7 @@ void toggle_script_asserts()
ui_print("Script Asserts: %s\n", script_assert_enabled ? "Enabled" : "Disabled");
}
void install_zip(const char* packagefilepath)
int install_zip(const char* packagefilepath)
{
ui_print("\n-- Installing: %s\n", packagefilepath);
set_sdcard_update_bootloader_message();
@ -59,13 +59,14 @@ void install_zip(const char* packagefilepath)
if (status != INSTALL_SUCCESS) {
ui_set_background(BACKGROUND_ICON_ERROR);
ui_print("Installation aborted.\n");
return;
return 1;
}
if (firmware_update_pending()) {
ui_print("\nReboot via menu to complete\ninstallation.\n");
}
ui_set_background(BACKGROUND_ICON_NONE);
ui_print("\nInstall from sdcard complete.\n");
return 0;
}
char* INSTALL_MENU_ITEMS[] = { "apply sdcard:update.zip",

View File

@ -30,3 +30,7 @@ do_mount_usb_storage();
void
show_choose_zip_menu();
int
install_zip(const char* packagefilepath);