aboutsummaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorDoug Zongker <dougz@google.com>2013-08-20 16:03:25 -0700
committerDoug Zongker <dougz@google.com>2013-08-21 13:44:35 -0700
commit239ac6abac4524be93fce710360c0512c6cc2ab3 (patch)
tree55428f9ad654b63d4002ca94902440648c955b96 /install.cpp
parentc0441d171914e59941ec4f815ae0aabf56d6504f (diff)
downloadbootable_recovery-239ac6abac4524be93fce710360c0512c6cc2ab3.zip
bootable_recovery-239ac6abac4524be93fce710360c0512c6cc2ab3.tar.gz
bootable_recovery-239ac6abac4524be93fce710360c0512c6cc2ab3.tar.bz2
recovery: install packages in a known mount environment
When installing a package, we should have /tmp and /cache mounted and nothing else. Ensure this is true by explicitly mounting them and unmounting everything else as the first step of every install. Also fix an error in the progress bar that crops up when you do multiple package installs in one instance of recovery. Change-Id: I4837ed707cb419ddd3d9f6188b6355ba1bcfe2b2
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/install.cpp b/install.cpp
index e1ab848..797a525 100644
--- a/install.cpp
+++ b/install.cpp
@@ -180,7 +180,9 @@ really_install_package(const char *path, int* wipe_cache)
{
ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
ui->Print("Finding update package...\n");
- ui->SetProgressType(RecoveryUI::INDETERMINATE);
+ // Give verification half the progress bar...
+ ui->SetProgressType(RecoveryUI::DETERMINATE);
+ ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
LOGI("Update location: %s\n", path);
if (ensure_path_mounted(path) != 0) {
@@ -198,10 +200,7 @@ really_install_package(const char *path, int* wipe_cache)
}
LOGI("%d key(s) loaded from %s\n", numKeys, PUBLIC_KEYS_FILE);
- // Give verification half the progress bar...
ui->Print("Verifying update package...\n");
- ui->SetProgressType(RecoveryUI::DETERMINATE);
- ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
int err;
err = verify_file(path, loadedKeys, numKeys);
@@ -237,7 +236,13 @@ install_package(const char* path, int* wipe_cache, const char* install_file)
} else {
LOGE("failed to open last_install: %s\n", strerror(errno));
}
- int result = really_install_package(path, wipe_cache);
+ int result;
+ if (setup_install_mounts() != 0) {
+ LOGE("failed to set up expected mounts for install; aborting\n");
+ result = INSTALL_ERROR;
+ } else {
+ result = really_install_package(path, wipe_cache);
+ }
if (install_log) {
fputc(result == INSTALL_SUCCESS ? '1' : '0', install_log);
fputc('\n', install_log);