void show_install_update_menu() { static char* headers[] = { "Apply update from .zip file on SD card", "", NULL }; for (;;) { int chosen_item = get_menu_selection(headers, INSTALL_MENU_ITEMS, 0, 0); switch (chosen_item) { case ITEM_ASSERTS: toggle_script_asserts(); break; case ITEM_SIG_CHECK: toggle_signature_check(); break; case ITEM_APPLY_SDCARD: { if (confirm_selection("Confirm install?", "Yes - Install /sdcard/update.zip")) install_zip(SDCARD_UPDATE_FILE); break; } case ITEM_CHOOSE_ZIP: show_choose_zip_menu(); break; default: return; } } }
void show_install_update_menu() { static char* headers[] = { "Install update from zip file", "", NULL }; char* install_menu_items[] = { "choose zip from sdcard", "install zip from sideload", "apply /sdcard/update.zip", "toggle signature verification", NULL, NULL }; char *other_sd = NULL; if (volume_for_path("/emmc") != NULL) { other_sd = "/emmc/"; install_menu_items[4] = "choose zip from internal sdcard"; } else if (volume_for_path("/external_sd") != NULL) { other_sd = "/external_sd/"; install_menu_items[4] = "choose zip from external sdcard"; } for (;;) { int chosen_item = get_menu_selection(headers, install_menu_items, 0, 0); switch (chosen_item) { case ITEM_SIG_CHECK: toggle_signature_check(); break; case ITEM_APPLY_UPDATE: { if (confirm_selection("Confirm install?", "Yes - Install /sdcard/update.zip")) install_zip(SDCARD_UPDATE_FILE); break; } case ITEM_CHOOSE_ZIP: show_choose_zip_menu("/sdcard/"); write_recovery_version(); break; case ITEM_APPLY_SIDELOAD: apply_from_adb(); break; case ITEM_CHOOSE_ZIP_INT: if (other_sd != NULL) show_choose_zip_menu(other_sd); break; default: return; } } }
void show_install_update_menu() { static char* headers[] = { "从SD卡选择ZIP格式文件进行刷机", "", NULL }; char* install_menu_items[] = { "从SD卡中选择一个ZIP格式刷机包", "从电脑用ADB载入刷机包", "直接应用/sdcard/update.zip刷机", "启用/禁用签名校验", NULL, NULL }; char *other_sd = NULL; if (volume_for_path("/emmc") != NULL) { other_sd = "/emmc/"; install_menu_items[4] = "从内置SD卡选择ZIP文件"; } else if (volume_for_path("/external_sd") != NULL) { other_sd = "/external_sd/"; install_menu_items[4] = "从外置SD卡选择ZIP文件"; } for (;;) { int chosen_item = get_menu_selection(headers, install_menu_items, 0, 0); switch (chosen_item) { case ITEM_SIG_CHECK: toggle_signature_check(); break; case ITEM_APPLY_UPDATE: { if (confirm_selection("确认安装?", "是-直接刷入/sdcard/update.zip")) install_zip(SDCARD_UPDATE_FILE); break; } case ITEM_CHOOSE_ZIP: show_choose_zip_menu("/sdcard/"); write_recovery_version(); break; case ITEM_APPLY_SIDELOAD: apply_from_adb(); break; case ITEM_CHOOSE_ZIP_INT: if (other_sd != NULL) show_choose_zip_menu(other_sd); break; default: return; } } }
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]); }
Value* InstallZipFn(const char* name, State* state, int argc, Expr* argv[]) { char* result = NULL; if (argc != 1) { return ErrorAbort(state, "%s() expects 1 args, got %d", name, argc); } char* path; if (ReadArgs(state, argv, 1, &path) < 0) { return NULL; } if (0 != install_zip(path)) return StringValue(strdup("")); return StringValue(strdup(path)); }
void updatemenu() { static char* headers[] = { "Update Menu", "", NULL }; static char* list[] = { "~~~> Go Back <~~~", "Update.zip from Sdcard", "Select .zip from Sdcard", "Toggle Signature Verification", "Toggle Script Asserts", NULL }; for (;;) { int chosen_item = get_menu_selection(headers, list, 0); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { return; break; } case 1: { if (confirm_selection("Confirm install?", "Yes - Install /sdcard/update.zip")) install_zip(SDCARD_PACKAGE_FILE); break; } case 2: { show_choose_zip_menu(); break; } case 3: toggle_signature_check(); break; case 4: toggle_script_asserts(); break; } } }
void show_choose_zip_menu(const char *mount_point) { if (ensure_path_mounted(mount_point) != 0) { LOGE ("Can't mount %s\n", mount_point); return; } static char* headers[] = { "Choose a zip to apply", "", NULL }; char* file = choose_file_menu(mount_point, ".zip", headers); if (file == NULL) return; static char* confirm_install = "Confirm install?"; static char confirm[PATH_MAX]; sprintf(confirm, "Yes - Install %s", basename(file)); if (confirm_selection(confirm_install, confirm)) install_zip(file); }
void show_choose_zip_menu(const char *mount_point) { if (ensure_path_mounted(mount_point) != 0) { LOGE ("无法挂载 %s\n", mount_point); return; } static char* headers[] = { "选择一个ZIP格式刷机包", "", NULL }; char* file = choose_file_menu(mount_point, ".zip", headers); if (file == NULL) return; static char* confirm_install = "确认安装?"; static char confirm[PATH_MAX]; sprintf(confirm, "是-刷入%s", basename(file)); if (confirm_selection(confirm_install, confirm)) install_zip(file); }
void show_choose_zip_menu() { if (ensure_root_path_mounted("SDCARD:") != 0) { LOGE ("Can't mount /sdcard\n"); return; } static char* headers[] = { "Choose a zip to apply", "", NULL }; char* file = choose_file_menu("/sdcard/", ".zip", headers); if (file == NULL) return; char sdcard_package_file[1024]; strcpy(sdcard_package_file, "SDCARD:"); strcat(sdcard_package_file, file + strlen("/sdcard/")); static char* confirm_install = "Confirm install?"; static char confirm[PATH_MAX]; sprintf(confirm, "Yes - Install %s", basename(file)); if (confirm_selection(confirm_install, confirm)) install_zip(sdcard_package_file); }
void show_install_update_menu() { #ifdef BOARD_HAS_SDCARD_INTERNAL char sdcard_package_file[PATH_MAX]; char confirm[PATH_MAX]; int chosen_sdcard = -1; #endif static char* headers[] = { "Apply update from .zip file on SD card", "", NULL }; for (;;) { int chosen_item = get_menu_selection(headers, INSTALL_MENU_ITEMS, 0, 0); switch (chosen_item) { case ITEM_ASSERTS: toggle_script_asserts(); break; case ITEM_SIG_CHECK: toggle_signature_check(); break; case ITEM_APPLY_SDCARD: { #ifdef BOARD_HAS_SDCARD_INTERNAL chosen_sdcard = show_sdcard_selection_menu(); if (chosen_sdcard > -1) { switch (chosen_sdcard) { case 0: sprintf(sdcard_package_file, "/sdcard/update.zip"); break; case 1: sprintf(sdcard_package_file, "/sdcard-ext/update.zip"); break; } sprintf(confirm, "Yes - Install %s", sdcard_package_file); } else break; if (confirm_selection("Confirm install?", confirm)) install_zip(sdcard_package_file); #else if (confirm_selection("Confirm install?", "Yes - Install /sdcard/update.zip")) install_zip(SDCARD_UPDATE_FILE); #endif break; } case ITEM_CHOOSE_ZIP: #ifdef BOARD_HAS_SDCARD_INTERNAL chosen_sdcard = show_sdcard_selection_menu(); if (chosen_sdcard > -1) { switch (chosen_sdcard) { case 0: show_choose_zip_menu("/sdcard"); break; case 1: show_choose_zip_menu("/sdcard-ext"); break; } } else break; #else show_choose_zip_menu("/sdcard"); #endif break; default: return; } } }