2010-02-12 06:27:06 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/reboot.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2010-02-12 08:43:24 +00:00
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/limits.h>
|
|
|
|
#include <dirent.h>
|
2010-02-25 22:51:05 +00:00
|
|
|
#include <sys/stat.h>
|
2010-02-12 08:43:24 +00:00
|
|
|
|
2010-02-25 19:39:07 +00:00
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
2010-02-12 06:27:06 +00:00
|
|
|
#include "bootloader.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "cutils/properties.h"
|
|
|
|
#include "firmware.h"
|
|
|
|
#include "install.h"
|
|
|
|
#include "minui/minui.h"
|
|
|
|
#include "minzip/DirUtil.h"
|
|
|
|
#include "roots.h"
|
|
|
|
#include "recovery_ui.h"
|
|
|
|
|
2010-03-07 21:39:21 +00:00
|
|
|
#include "commands.h"
|
|
|
|
#include "amend/amend.h"
|
|
|
|
|
2010-03-13 01:00:58 +00:00
|
|
|
#include "mtdutils/dump_image.h"
|
|
|
|
#include "../../external/yaffs2/yaffs2/utils/mkyaffs2image.h"
|
2010-03-13 01:43:26 +00:00
|
|
|
#include "../../external/yaffs2/yaffs2/utils/unyaffs.h"
|
2010-03-13 01:00:58 +00:00
|
|
|
|
2010-03-13 07:21:12 +00:00
|
|
|
#include "extendedcommands.h"
|
|
|
|
#include "nandroid.h"
|
|
|
|
|
2010-02-12 06:27:06 +00:00
|
|
|
int signature_check_enabled = 1;
|
|
|
|
int script_assert_enabled = 1;
|
2010-02-22 05:10:25 +00:00
|
|
|
static const char *SDCARD_PACKAGE_FILE = "SDCARD:update.zip";
|
2010-02-12 06:27:06 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
toggle_signature_check()
|
|
|
|
{
|
|
|
|
signature_check_enabled = !signature_check_enabled;
|
|
|
|
ui_print("Signature Check: %s\n", signature_check_enabled ? "Enabled" : "Disabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
void toggle_script_asserts()
|
|
|
|
{
|
|
|
|
script_assert_enabled = !script_assert_enabled;
|
2010-02-12 08:43:24 +00:00
|
|
|
ui_print("Script Asserts: %s\n", script_assert_enabled ? "Enabled" : "Disabled");
|
|
|
|
}
|
|
|
|
|
2010-03-08 10:58:04 +00:00
|
|
|
int install_zip(const char* packagefilepath)
|
2010-02-22 05:10:25 +00:00
|
|
|
{
|
|
|
|
ui_print("\n-- Installing: %s\n", packagefilepath);
|
|
|
|
set_sdcard_update_bootloader_message();
|
|
|
|
int status = install_package(packagefilepath);
|
2010-03-03 08:42:58 +00:00
|
|
|
ui_reset_progress();
|
2010-02-22 05:10:25 +00:00
|
|
|
if (status != INSTALL_SUCCESS) {
|
|
|
|
ui_set_background(BACKGROUND_ICON_ERROR);
|
|
|
|
ui_print("Installation aborted.\n");
|
2010-03-08 10:58:04 +00:00
|
|
|
return 1;
|
2010-02-25 20:03:17 +00:00
|
|
|
}
|
|
|
|
if (firmware_update_pending()) {
|
|
|
|
ui_print("\nReboot via menu to complete\ninstallation.\n");
|
2010-02-25 22:53:57 +00:00
|
|
|
}
|
|
|
|
ui_set_background(BACKGROUND_ICON_NONE);
|
2010-03-03 08:42:58 +00:00
|
|
|
ui_print("\nInstall from sdcard complete.\n");
|
2010-03-08 10:58:04 +00:00
|
|
|
return 0;
|
2010-02-22 05:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char* INSTALL_MENU_ITEMS[] = { "apply sdcard:update.zip",
|
|
|
|
"choose zip from sdcard",
|
|
|
|
"toggle signature verification",
|
|
|
|
"toggle script asserts",
|
|
|
|
NULL };
|
|
|
|
#define ITEM_APPLY_SDCARD 0
|
|
|
|
#define ITEM_CHOOSE_ZIP 1
|
|
|
|
#define ITEM_SIG_CHECK 2
|
|
|
|
#define ITEM_ASSERTS 3
|
|
|
|
|
|
|
|
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);
|
|
|
|
switch (chosen_item)
|
|
|
|
{
|
|
|
|
case ITEM_ASSERTS:
|
|
|
|
toggle_script_asserts();
|
|
|
|
break;
|
|
|
|
case ITEM_SIG_CHECK:
|
|
|
|
toggle_signature_check();
|
|
|
|
break;
|
|
|
|
case ITEM_APPLY_SDCARD:
|
|
|
|
install_zip(SDCARD_PACKAGE_FILE);
|
|
|
|
break;
|
|
|
|
case ITEM_CHOOSE_ZIP:
|
|
|
|
show_choose_zip_menu();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-25 22:51:05 +00:00
|
|
|
char** gather_files(const char* directory, const char* fileExtensionOrDirectory, int* numFiles)
|
2010-02-12 08:43:24 +00:00
|
|
|
{
|
|
|
|
char path[PATH_MAX] = "";
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *de;
|
|
|
|
int total = 0;
|
|
|
|
int i;
|
2010-03-13 07:21:12 +00:00
|
|
|
char** files = NULL;
|
2010-02-25 22:53:57 +00:00
|
|
|
int pass;
|
|
|
|
*numFiles = 0;
|
|
|
|
int dirLen = strlen(directory);
|
2010-02-12 08:43:24 +00:00
|
|
|
|
2010-02-22 05:10:25 +00:00
|
|
|
dir = opendir(directory);
|
2010-02-12 08:43:24 +00:00
|
|
|
if (dir == NULL) {
|
2010-02-22 05:10:25 +00:00
|
|
|
ui_print("Couldn't open directory.\n");
|
|
|
|
return NULL;
|
2010-02-12 08:43:24 +00:00
|
|
|
}
|
2010-02-22 05:10:25 +00:00
|
|
|
|
2010-03-13 07:21:12 +00:00
|
|
|
int extension_length = 0;
|
2010-02-25 22:53:57 +00:00
|
|
|
if (fileExtensionOrDirectory != NULL)
|
|
|
|
extension_length = strlen(fileExtensionOrDirectory);
|
2010-02-22 05:10:25 +00:00
|
|
|
|
2010-02-25 22:53:57 +00:00
|
|
|
int isCounting = 1;
|
|
|
|
i = 0;
|
|
|
|
for (pass = 0; pass < 2; pass++) {
|
|
|
|
while ((de=readdir(dir)) != NULL) {
|
|
|
|
// skip hidden files
|
|
|
|
if (de->d_name[0] == '.')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// NULL means that we are gathering directories, so skip this
|
|
|
|
if (fileExtensionOrDirectory != NULL)
|
|
|
|
{
|
|
|
|
// make sure that we can have the desired extension (prevent seg fault)
|
|
|
|
if (strlen(de->d_name) < extension_length)
|
|
|
|
continue;
|
|
|
|
// compare the extension
|
|
|
|
if (strcmp(de->d_name + strlen(de->d_name) - extension_length, fileExtensionOrDirectory) != 0)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct stat info;
|
|
|
|
char* fullFileName = (char*)malloc(strlen(de->d_name) + dirLen + 1);
|
|
|
|
strcpy(fullFileName, directory);
|
|
|
|
strcat(fullFileName, de->d_name);
|
|
|
|
stat(fullFileName, &info);
|
|
|
|
free(fullFileName);
|
|
|
|
// make sure it is a directory
|
|
|
|
if (!(S_ISDIR(info.st_mode)))
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pass == 0)
|
|
|
|
{
|
|
|
|
total++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-02-25 22:51:05 +00:00
|
|
|
files[i] = (char*) malloc(dirLen + strlen(de->d_name) + 2);
|
|
|
|
strcpy(files[i], directory);
|
|
|
|
strcat(files[i], de->d_name);
|
2010-02-25 22:53:57 +00:00
|
|
|
if (fileExtensionOrDirectory == NULL)
|
|
|
|
strcat(files[i], "/");
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (pass == 1)
|
|
|
|
break;
|
|
|
|
if (total == 0)
|
|
|
|
break;
|
|
|
|
rewinddir(dir);
|
|
|
|
*numFiles = total;
|
|
|
|
files = (char**) malloc((total+1)*sizeof(char*));
|
|
|
|
files[total]=NULL;
|
|
|
|
}
|
2010-02-25 22:51:05 +00:00
|
|
|
|
|
|
|
if(closedir(dir) < 0) {
|
|
|
|
LOGE("Failed to close directory.");
|
2010-02-12 08:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (total==0) {
|
2010-02-22 05:10:25 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2010-02-12 08:43:24 +00:00
|
|
|
|
2010-02-25 22:53:57 +00:00
|
|
|
return files;
|
2010-02-25 22:51:05 +00:00
|
|
|
}
|
2010-02-12 08:43:24 +00:00
|
|
|
|
2010-02-25 22:51:05 +00:00
|
|
|
void free_string_array(char** array)
|
|
|
|
{
|
2010-02-25 22:53:57 +00:00
|
|
|
char* cursor = array[0];
|
|
|
|
int i = 0;
|
|
|
|
while (cursor != NULL)
|
|
|
|
{
|
|
|
|
free(cursor);
|
|
|
|
cursor = array[++i];
|
|
|
|
}
|
|
|
|
free(array);
|
2010-02-25 22:51:05 +00:00
|
|
|
}
|
2010-02-22 05:10:25 +00:00
|
|
|
|
2010-02-25 22:51:05 +00:00
|
|
|
// pass in NULL for fileExtensionOrDirectory and you will get a directory chooser
|
|
|
|
char* choose_file_menu(const char* directory, const char* fileExtensionOrDirectory, const char* headers[])
|
|
|
|
{
|
|
|
|
char path[PATH_MAX] = "";
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *de;
|
|
|
|
int numFiles = 0;
|
2010-02-25 22:53:57 +00:00
|
|
|
int numDirs = 0;
|
2010-02-25 22:51:05 +00:00
|
|
|
int i;
|
2010-02-22 05:10:25 +00:00
|
|
|
|
2010-02-25 22:53:57 +00:00
|
|
|
int dir_len = strlen(directory);
|
|
|
|
|
|
|
|
char** files = gather_files(directory, fileExtensionOrDirectory, &numFiles);
|
2010-03-13 07:21:12 +00:00
|
|
|
char** dirs = NULL;
|
2010-02-25 22:53:57 +00:00
|
|
|
if (fileExtensionOrDirectory != NULL)
|
|
|
|
dirs = gather_files(directory, NULL, &numDirs);
|
|
|
|
int total = numDirs + numFiles;
|
|
|
|
if (total == 0)
|
|
|
|
{
|
|
|
|
ui_print("No files found.\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
char** list = (char**) malloc((total + 1) * sizeof(char*));
|
|
|
|
list[total] = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0 ; i < numDirs; i++)
|
|
|
|
{
|
|
|
|
list[i] = strdup(dirs[i] + dir_len);
|
2010-02-12 08:43:24 +00:00
|
|
|
}
|
2010-02-22 05:10:25 +00:00
|
|
|
|
2010-02-25 22:53:57 +00:00
|
|
|
for (i = 0 ; i < numFiles; i++)
|
|
|
|
{
|
|
|
|
list[numDirs + i] = strdup(files[i] + dir_len);
|
2010-02-22 05:10:25 +00:00
|
|
|
}
|
|
|
|
|
2010-02-22 16:53:34 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
int chosen_item = get_menu_selection(headers, list, 0);
|
|
|
|
if (chosen_item == GO_BACK)
|
|
|
|
break;
|
2010-02-25 22:53:57 +00:00
|
|
|
if (chosen_item < numDirs)
|
|
|
|
{
|
|
|
|
char* subret = choose_file_menu(dirs[chosen_item], fileExtensionOrDirectory, headers);
|
|
|
|
if (subret != NULL)
|
|
|
|
return subret;
|
|
|
|
continue;
|
|
|
|
}
|
2010-02-22 16:53:34 +00:00
|
|
|
static char ret[PATH_MAX];
|
2010-02-25 22:51:05 +00:00
|
|
|
strcpy(ret, files[chosen_item - numDirs]);
|
2010-02-22 16:53:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return NULL;
|
2010-02-22 05:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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/"));
|
|
|
|
install_zip(sdcard_package_file);
|
|
|
|
}
|
|
|
|
|
2010-02-25 19:39:07 +00:00
|
|
|
// This was pulled from bionic: The default system command always looks
|
|
|
|
// for shell in /system/bin/sh. This is bad.
|
|
|
|
#define _PATH_BSHELL "/sbin/sh"
|
2010-03-13 07:21:12 +00:00
|
|
|
|
2010-02-25 19:39:07 +00:00
|
|
|
extern char **environ;
|
|
|
|
int
|
2010-03-13 07:21:12 +00:00
|
|
|
__system(const char *command)
|
2010-02-25 19:39:07 +00:00
|
|
|
{
|
|
|
|
pid_t pid;
|
2010-02-25 22:53:57 +00:00
|
|
|
sig_t intsave, quitsave;
|
|
|
|
sigset_t mask, omask;
|
|
|
|
int pstat;
|
|
|
|
char *argp[] = {"sh", "-c", NULL, NULL};
|
|
|
|
|
|
|
|
if (!command) /* just checking... */
|
|
|
|
return(1);
|
|
|
|
|
|
|
|
argp[2] = (char *)command;
|
|
|
|
|
|
|
|
sigemptyset(&mask);
|
|
|
|
sigaddset(&mask, SIGCHLD);
|
|
|
|
sigprocmask(SIG_BLOCK, &mask, &omask);
|
|
|
|
switch (pid = vfork()) {
|
|
|
|
case -1: /* error */
|
|
|
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
|
|
|
return(-1);
|
|
|
|
case 0: /* child */
|
|
|
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
|
|
|
execve(_PATH_BSHELL, argp, environ);
|
2010-02-25 19:39:07 +00:00
|
|
|
_exit(127);
|
|
|
|
}
|
|
|
|
|
2010-02-25 22:53:57 +00:00
|
|
|
intsave = (sig_t) bsd_signal(SIGINT, SIG_IGN);
|
|
|
|
quitsave = (sig_t) bsd_signal(SIGQUIT, SIG_IGN);
|
|
|
|
pid = waitpid(pid, (int *)&pstat, 0);
|
|
|
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
|
|
|
(void)bsd_signal(SIGINT, intsave);
|
|
|
|
(void)bsd_signal(SIGQUIT, quitsave);
|
|
|
|
return (pid == -1 ? -1 : pstat);
|
2010-02-25 19:39:07 +00:00
|
|
|
}
|
|
|
|
|
2010-03-13 01:00:58 +00:00
|
|
|
int print_and_error(char* message)
|
|
|
|
{
|
|
|
|
ui_print(message);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-02-22 05:10:25 +00:00
|
|
|
void show_nandroid_restore_menu()
|
|
|
|
{
|
2010-03-13 01:43:26 +00:00
|
|
|
if (ensure_root_path_mounted("SDCARD:") != 0) {
|
|
|
|
LOGE ("Can't mount /sdcard\n");
|
2010-03-13 07:21:12 +00:00
|
|
|
return;
|
2010-03-13 01:43:26 +00:00
|
|
|
}
|
|
|
|
|
2010-02-22 05:10:25 +00:00
|
|
|
static char* headers[] = { "Choose an image to restore",
|
|
|
|
"",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2010-02-25 22:51:05 +00:00
|
|
|
char* file = choose_file_menu("/sdcard/clockworkmod/backup/", NULL, headers);
|
2010-02-22 05:10:25 +00:00
|
|
|
if (file == NULL)
|
|
|
|
return;
|
2010-03-13 07:21:12 +00:00
|
|
|
nandroid_restore(file);
|
2010-02-26 22:14:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void do_mount_usb_storage()
|
|
|
|
{
|
|
|
|
system("echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file");
|
|
|
|
static char* headers[] = { "USB Mass Storage device",
|
|
|
|
"Leaving this menu unmount",
|
|
|
|
"your SD card from your PC.",
|
|
|
|
"",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static char* list[] = { "Unmount", NULL };
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
int chosen_item = get_menu_selection(headers, list, 0);
|
|
|
|
if (chosen_item == GO_BACK || chosen_item == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-27 01:44:33 +00:00
|
|
|
system("echo '' > /sys/devices/platform/usb_mass_storage/lun0/file");
|
2010-02-26 22:14:23 +00:00
|
|
|
system("echo 0 > /sys/devices/platform/usb_mass_storage/lun0/enable");
|
2010-02-27 01:44:33 +00:00
|
|
|
}
|
2010-03-07 21:39:21 +00:00
|
|
|
|
2010-03-07 22:10:26 +00:00
|
|
|
#define EXTENDEDCOMMAND_SCRIPT "/cache/recovery/extendedcommand"
|
2010-03-07 21:39:21 +00:00
|
|
|
|
2010-03-07 22:10:26 +00:00
|
|
|
int extendedcommand_file_exists()
|
|
|
|
{
|
|
|
|
struct stat file_info;
|
|
|
|
return 0 == stat(EXTENDEDCOMMAND_SCRIPT, &file_info);
|
|
|
|
}
|
2010-03-07 21:39:21 +00:00
|
|
|
|
2010-03-12 06:17:43 +00:00
|
|
|
int run_script_from_buffer(char* script_data, int script_len, char* filename)
|
2010-03-07 22:10:26 +00:00
|
|
|
{
|
2010-03-07 21:39:21 +00:00
|
|
|
/* Parse the script. Note that the script and parse tree are never freed.
|
|
|
|
*/
|
|
|
|
const AmCommandList *commands = parseAmendScript(script_data, script_len);
|
|
|
|
if (commands == NULL) {
|
|
|
|
printf("Syntax error in update script\n");
|
|
|
|
return 1;
|
|
|
|
} else {
|
2010-03-07 22:10:26 +00:00
|
|
|
printf("Parsed %.*s\n", script_len, filename);
|
2010-03-07 21:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Execute the script.
|
|
|
|
*/
|
|
|
|
int ret = execCommandList((ExecContext *)1, commands);
|
|
|
|
if (ret != 0) {
|
|
|
|
int num = ret;
|
2010-03-13 07:21:12 +00:00
|
|
|
char *line = NULL, *next = script_data;
|
2010-03-07 21:39:21 +00:00
|
|
|
while (next != NULL && ret-- > 0) {
|
|
|
|
line = next;
|
|
|
|
next = memchr(line, '\n', script_data + script_len - line);
|
|
|
|
if (next != NULL) *next++ = '\0';
|
|
|
|
}
|
|
|
|
printf("Failure at line %d:\n%s\n", num, next ? line : "(not found)");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2010-03-07 22:10:26 +00:00
|
|
|
|
2010-03-12 06:17:43 +00:00
|
|
|
int run_script(char* filename, int delete_file)
|
|
|
|
{
|
|
|
|
struct stat file_info;
|
|
|
|
if (0 != stat(filename, &file_info)) {
|
|
|
|
printf("Error executing stat on file: %s\n", filename);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int script_len = file_info.st_size;
|
|
|
|
char* script_data = (char*)malloc(script_len);
|
|
|
|
FILE *file = fopen(filename, "rb");
|
|
|
|
fread(script_data, script_len, 1, file);
|
|
|
|
fclose(file);
|
|
|
|
if (delete_file)
|
|
|
|
remove(filename);
|
|
|
|
|
|
|
|
return run_script_from_buffer(script_data, script_len, filename);
|
|
|
|
}
|
|
|
|
|
2010-03-07 22:10:26 +00:00
|
|
|
int run_and_remove_extendedcommand()
|
|
|
|
{
|
2010-03-09 03:22:41 +00:00
|
|
|
int i = 0;
|
|
|
|
for (i = 20; i > 0; i--) {
|
|
|
|
ui_print("Waiting for SD Card to mount (%ds)\n", i);
|
|
|
|
if (ensure_root_path_mounted("SDCARD:") == 0) {
|
|
|
|
ui_print("SD Card mounted...\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sleep(1);
|
|
|
|
}
|
|
|
|
if (i == 0) {
|
|
|
|
ui_print("Timed out waiting for SD card... continuing anyways.");
|
|
|
|
}
|
|
|
|
|
2010-03-12 06:17:43 +00:00
|
|
|
return run_script(EXTENDEDCOMMAND_SCRIPT, 1);
|
2010-03-07 22:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int amend_main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
if (argc != 2)
|
|
|
|
{
|
|
|
|
printf("Usage: amend <script>\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
RecoveryCommandContext ctx = { NULL };
|
|
|
|
if (register_update_commands(&ctx)) {
|
|
|
|
LOGE("Can't install update commands\n");
|
|
|
|
}
|
2010-03-12 06:17:43 +00:00
|
|
|
return run_script(argv[1], 0);
|
2010-03-08 22:09:35 +00:00
|
|
|
}
|