diff options
author | Tianjie Xu <xunchang@google.com> | 2019-08-01 00:34:34 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-08-01 00:34:34 +0200 |
commit | c34e4e7fb58d335ed985e561752e300168b1db4c (patch) | |
tree | 2c3f3befcf97039b2670395d18a2f953bc1c70c4 /updater/build_info.cpp | |
parent | Merge "Create a new function to return the help message for menu" (diff) | |
parent | Simulator: add the argument to keep the updated images (diff) | |
download | android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.tar android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.tar.gz android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.tar.bz2 android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.tar.lz android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.tar.xz android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.tar.zst android_bootable_recovery-c34e4e7fb58d335ed985e561752e300168b1db4c.zip |
Diffstat (limited to 'updater/build_info.cpp')
-rw-r--r-- | updater/build_info.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/updater/build_info.cpp b/updater/build_info.cpp index 3072aab54..f168008ec 100644 --- a/updater/build_info.cpp +++ b/updater/build_info.cpp @@ -16,6 +16,8 @@ #include "updater/build_info.h" +#include <stdio.h> + #include <set> #include <vector> @@ -55,12 +57,23 @@ bool BuildInfo::ParseTargetFile(const std::string_view target_file_path, bool ex return false; } + std::string mapped_path = image_file.path; + // Rename the images to more readable ones if we want to keep the image. + if (keep_images_) { + mapped_path = work_dir_ + fstab_info.mount_point + ".img"; + image_file.release(); + if (rename(image_file.path, mapped_path.c_str()) != 0) { + PLOG(ERROR) << "Failed to rename " << image_file.path << " to " << mapped_path; + return false; + } + } + LOG(INFO) << "Mounted " << fstab_info.mount_point << "\nMapping: " << fstab_info.blockdev_name - << " to " << image_file.path; + << " to " << mapped_path; blockdev_map_.emplace( fstab_info.blockdev_name, - FakeBlockDevice(fstab_info.blockdev_name, fstab_info.mount_point, image_file.path)); + FakeBlockDevice(fstab_info.blockdev_name, fstab_info.mount_point, mapped_path)); break; } } |