summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-10-09 18:15:26 +0200
committerEthan Yonker <dees_troy@teamw.in>2015-10-09 18:15:29 +0200
commitc798c9cd2486e0ff83776002c74f113677b10a84 (patch)
treed128a80cbc58e63a622fda2774e727611f9d2cd4 /install.cpp
parentAdd TW_IGNORE_ABS_MT_TRACKING_ID (diff)
parentmerge in mnc-release history after reset to mnc-dev (diff)
downloadandroid_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.gz
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.bz2
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.lz
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.xz
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.zst
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.zip
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/install.cpp b/install.cpp
index 8e3d6d6d9..b46bbdf9d 100644
--- a/install.cpp
+++ b/install.cpp
@@ -18,6 +18,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -47,7 +48,7 @@ static const float DEFAULT_IMAGE_PROGRESS_FRACTION = 0.1;
// If the package contains an update binary, extract it and run it.
static int
-try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
+try_update_binary(const char* path, ZipArchive* zip, bool* wipe_cache) {
const ZipEntry* binary_entry =
mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);
if (binary_entry == NULL) {
@@ -87,7 +88,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
// fill up the next <frac> part of of the progress bar
// over <secs> seconds. If <secs> is zero, use
// set_progress commands to manually control the
- // progress of this segment of the bar
+ // progress of this segment of the bar.
//
// set_progress <frac>
// <frac> should be between 0.0 and 1.0; sets the
@@ -106,6 +107,18 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
// ui_print <string>
// display <string> on the screen.
//
+ // wipe_cache
+ // a wipe of cache will be performed following a successful
+ // installation.
+ //
+ // clear_display
+ // turn off the text display.
+ //
+ // enable_reboot
+ // packages can explicitly request that they want the user
+ // to be able to reboot during installation (useful for
+ // debugging packages that don't exit).
+ //
// - the name of the package zip file.
//
@@ -128,7 +141,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
}
close(pipefd[1]);
- *wipe_cache = 0;
+ *wipe_cache = false;
char buffer[1024];
FILE* from_child = fdopen(pipefd[0], "r");
@@ -157,7 +170,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
}
fflush(stdout);
} else if (strcmp(command, "wipe_cache") == 0) {
- *wipe_cache = 1;
+ *wipe_cache = true;
} else if (strcmp(command, "clear_display") == 0) {
ui->SetBackground(RecoveryUI::NONE);
} else if (strcmp(command, "enable_reboot") == 0) {
@@ -182,7 +195,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
}
static int
-really_install_package(const char *path, int* wipe_cache, bool needs_mount)
+really_install_package(const char *path, bool* wipe_cache, bool needs_mount)
{
ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
ui->Print("Finding update package...\n");
@@ -252,9 +265,11 @@ really_install_package(const char *path, int* wipe_cache, bool needs_mount)
}
int
-install_package(const char* path, int* wipe_cache, const char* install_file,
+install_package(const char* path, bool* wipe_cache, const char* install_file,
bool needs_mount)
{
+ modified_flash = true;
+
FILE* install_log = fopen_path(install_file, "w");
if (install_log) {
fputs(path, install_log);