int install_apk (char *filename, char *location) { ui_print ("\n-- Installing APK from\n"); ui_print ("%s", filename); ui_print ("\nTo\n"); ensure_path_mounted ("/sdcard"); ensure_path_mounted (location); char locString[PATH_MAX]; char *basename = strrchr (filename, '/') + 1; strcpy (locString, location); strcat (locString, basename); ui_print ("%s", locString); char *permString; if (strcmp (location, "/data/app/") == 0) permString = "1000:1000"; if (strcmp (location, "/system/app/") == 0) permString = "0:0"; char *argv[] = { "/sbin/busybox ", "cp", filename, location, NULL }; char *envp[] = { NULL }; runve ("/sbin/busybox", argv, envp, 1); char *argy[] = { "/sbin/busybox ", "chown", permString, locString, NULL }; char *envy[] = { NULL }; runve ("/sbin/busybox", argy, envy, 1); ui_print ("\nAPK install from sdcard complete."); ui_print ("\nThanks for using RZrecovery.\n"); return 0; }
int install_rom_from_tar (char *filename) { ui_print ("Attempting to install ROM from "); ui_print ("%s", filename); ui_print ("...\n"); char *argv[] = { "/sbin/nandroid-mobile.sh", "--install-rom", filename, "--progress", NULL }; char *envp[] = { NULL }; int status = runve ("/sbin/nandroid-mobile.sh", argv, envp, 1); if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { ui_printf_int ("ERROR: install exited with status %d\n", WEXITSTATUS (status)); return WEXITSTATUS (status); } else { ui_print ("(done)\n"); } ui_reset_progress (); return 0; }
int install_rom_from_tar(char* filename) { if (ui_key_pressed(KEY_SPACE)) { ui_print("Backing up before installing...\n"); nandroid_backup("preinstall",BSD|PROGRESS); } ui_print("Attempting to install ROM from "); ui_print(filename); ui_print("...\n"); char* argv[] = { "/sbin/nandroid-mobile.sh", "--install-rom", filename, "--progress", NULL }; char* envp[] = { NULL }; int status = runve("/sbin/nandroid-mobile.sh",argv,envp,1); if(!WIFEXITED(status) || WEXITSTATUS(status)!=0) { ui_printf_int("ERROR: install exited with status %d\n",WEXITSTATUS(status)); return WEXITSTATUS(status); } else { ui_print("(done)\n"); } ui_reset_progress(); return 0; }
void root_menu(int confirm) { if (confirm) { static char** title_headers = NULL; if (title_headers == NULL) { char* headers[] = { "ROOT installed ROM?", " ", "Rooting without the superuser app installed", "does nothing. Please install the superuser app", "from the market! (by ChainsDD)", " ", NULL }; title_headers = prepend_title(headers); } char* items[] = { " No", " OK, give me root!", NULL }; int chosen_item = get_menu_selection(title_headers, items, 1, 0); if (chosen_item != 1) { return; } } char* argv[] = { "/sbin/actroot", NULL }; char* envp[] = { NULL }; ensure_root_path_mounted("SYSTEM:"); remove("/system/recovery-from-boot.p"); int status = runve("/sbin/actroot",argv,envp,1); ensure_root_path_unmounted("SYSTEM:"); return; }
void fix_permissions() { char* argv[] = { "/sbin/fix_permissions", NULL }; char* envp[] = { NULL }; int status = runve("/sbin/fix_permissions",argv,envp,1); return; }
int install_img (char *filename, char *partition) { ui_print ("\n-- Flash image from...\n"); ui_print ("%s", filename); ui_print ("\n"); ensure_path_mounted ("/sdcard"); char *argv[] = { "/sbin/flash_image", partition, filename, NULL }; char *envp[] = { NULL }; int status = runve ("/sbin/flash_image", argv, envp, 1); ui_print ("\nFlash from sdcard complete."); ui_print ("\nThanks for using RZrecovery.\n"); return 0; }
extern pid_t spawnve(int mode, const char* path, char* const* argv, char* const* envv) { return runve(mode, path, argv, envv); }
extern pid_t execve(const char* path, char* const* argv, char* const* envv) { return runve(_P_OVERLAY, path, argv, envv); }