aboutsummaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2014-11-24 16:02:04 -0800
committerTom Marshall <tdm.code@gmail.com>2017-09-17 15:24:54 +0000
commit08cd1c0bcbf2bb183445651e2a2179a6aae61404 (patch)
treeb8973707a03d99a26ede08ef0fd30b248b895844 /install.cpp
parent6aab7a1d6a88d68278a6874744cefda8f774101e (diff)
downloadandroid_bootable_recovery-08cd1c0bcbf2bb183445651e2a2179a6aae61404.tar.gz
android_bootable_recovery-08cd1c0bcbf2bb183445651e2a2179a6aae61404.tar.bz2
android_bootable_recovery-08cd1c0bcbf2bb183445651e2a2179a6aae61404.zip
recovery: Awakening of MiniVold
A minimal vold client for recovery. Change-Id: Id25d955dc1861a910e5f5fc27d9a19e245d66833
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/install.cpp b/install.cpp
index 58376525..b33247cb 100644
--- a/install.cpp
+++ b/install.cpp
@@ -560,6 +560,27 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
// Give verification half the progress bar...
ui->SetProgressType(RecoveryUI::DETERMINATE);
ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
+
+ // Resolve symlink in case legacy /sdcard path is used
+ // Requires: symlink uses absolute path
+ char new_path[PATH_MAX];
+ if (strlen(path) > 1) {
+ const char *rest = strchr(path + 1, '/');
+ if (rest != NULL) {
+ int readlink_length;
+ int root_length = rest - path;
+ char *root = (char *)malloc(root_length + 1);
+ strncpy(root, path, root_length);
+ root[root_length] = 0;
+ readlink_length = readlink(root, new_path, PATH_MAX);
+ if (readlink_length > 0) {
+ strncpy(new_path + readlink_length, rest, PATH_MAX - readlink_length);
+ path = new_path;
+ }
+ free(root);
+ }
+ }
+
LOG(INFO) << "Update location: " << path;
// Map the update package into memory.