summaryrefslogtreecommitdiffstats
path: root/recovery.c
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-09-16 02:03:51 +0200
committerDoug Zongker <dougz@android.com>2010-09-16 02:03:51 +0200
commitd7693c4c8e0825927fe5d76133fed96b43e60afb (patch)
treea8d5e6cdcecda5b508a4388dc2713770b20117a4 /recovery.c
parentam 858f0a76: am 8e5e4dad: close update package before installing; allow remount (diff)
parentam 8674a726: (cherry-pick) support installing any .zip file on the sdcard (diff)
downloadandroid_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.tar
android_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.tar.gz
android_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.tar.bz2
android_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.tar.lz
android_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.tar.xz
android_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.tar.zst
android_bootable_recovery-d7693c4c8e0825927fe5d76133fed96b43e60afb.zip
Diffstat (limited to 'recovery.c')
-rw-r--r--recovery.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/recovery.c b/recovery.c
index 779e77d76..286f1e5a7 100644
--- a/recovery.c
+++ b/recovery.c
@@ -53,7 +53,7 @@ static const struct option OPTIONS[] = {
static const char *COMMAND_FILE = "CACHE:recovery/command";
static const char *INTENT_FILE = "CACHE:recovery/intent";
static const char *LOG_FILE = "CACHE:recovery/log";
-static const char *EXT_ROOT = "EXT:";
+static const char *SDCARD_ROOT = "SDCARD:";
static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
static const char *SIDELOAD_TEMP_DIR = "TMP:sideload";
@@ -477,14 +477,6 @@ static int compare_string(const void* a, const void* b) {
static int
sdcard_directory(const char* root_path) {
- // Mount the sdcard when the package selection menu is enabled so
- // you can "adb push" packages to the sdcard and immediately
- // install them.
- if (ensure_root_path_mounted(EXT_ROOT) < 0) {
- ui_print("Failed to mount external storage.\n");
- return INSTALL_ERROR;
- }
-
const char* MENU_HEADERS[] = { "Choose a package to install:",
root_path,
"",
@@ -495,7 +487,6 @@ sdcard_directory(const char* root_path) {
d = opendir(translate_root_path(root_path, path, sizeof(path)));
if (d == NULL) {
LOGE("error opening %s: %s\n", path, strerror(errno));
- ensure_root_path_unmounted(EXT_ROOT);
return 0;
}
@@ -552,7 +543,7 @@ sdcard_directory(const char* root_path) {
z_size += d_size;
zips[z_size] = NULL;
- int result = INSTALL_CORRUPT;
+ int result;
int chosen_item = 0;
do {
chosen_item = get_menu_selection(headers, zips, 1, chosen_item);
@@ -578,12 +569,8 @@ sdcard_directory(const char* root_path) {
strlcat(new_path, item, PATH_MAX);
ui_print("\n-- Install %s ...\n", new_path);
- char* copy = copy_sideloaded_package(new_path);
- if (copy != NULL) {
- set_sdcard_update_bootloader_message();
- result = install_package(copy);
- free(copy);
- }
+ set_sdcard_update_bootloader_message();
+ result = install_package(new_path);
break;
}
} while (true);
@@ -593,7 +580,6 @@ sdcard_directory(const char* root_path) {
free(zips);
free(headers);
- ensure_root_path_unmounted(EXT_ROOT);
return result;
}
@@ -667,9 +653,9 @@ prompt_and_wait() {
if (!ui_text_visible()) return;
break;
- case ITEM_APPLY_EXT:
+ case ITEM_APPLY_SDCARD:
;
- int status = sdcard_directory(EXT_ROOT);
+ int status = sdcard_directory(SDCARD_ROOT);
if (status >= 0) {
if (status != INSTALL_SUCCESS) {
ui_set_background(BACKGROUND_ICON_ERROR);
@@ -792,6 +778,9 @@ main(int argc, char **argv) {
if (status != INSTALL_SUCCESS) ui_set_background(BACKGROUND_ICON_ERROR);
if (status != INSTALL_SUCCESS || ui_text_visible()) {
+ // Mount the sdcard when the menu is enabled so you can "adb
+ // push" packages to the sdcard and immediately install them.
+ ensure_root_path_mounted(SDCARD_ROOT);
prompt_and_wait();
}