Loading install/install.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,19 @@ bool SetupPackageMount(const std::string& package_path, bool* should_use_fuse) { LOG(ERROR) << "Failed to mount " << block_map_path; return false; } auto block_map_data = BlockMapData::ParseBlockMapFile(block_map_path); if (!CheckPathCanonical(block_map_data.path())) { LOG(ERROR) << "Block map " << package_path << " contains non-canonical path " << block_map_data.path() << " abort installation."; return false; } if (!BlockDevHasFstab(block_map_data.path())) { LOG(ERROR) << "Block device " << block_map_path << " does not have corresponding fstab. This might be an external device, " "aborting installation."; return false; } // uncrypt only produces block map only if the package stays on /data. *should_use_fuse = false; return true; Loading recovery_utils/include/recovery_utils/roots.h +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ Volume* volume_for_mount_point(const std::string& mount_point); // success (volume is mounted). int ensure_path_mounted(const std::string& path); // Return true if the block device has a corresponding entry // in fstab bool BlockDevHasFstab(const std::string& path); // Similar to ensure_path_mounted, but allows one to specify the mount_point. int ensure_path_mounted_at(const std::string& path, const std::string& mount_point); Loading recovery_utils/roots.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <string> #include <vector> #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> Loading Loading @@ -90,6 +91,25 @@ int ensure_path_unmounted(const std::string& path) { return android::fs_mgr::EnsurePathUnmounted(&fstab, path) ? 0 : -1; } bool BlockDevHasFstab(const std::string& path) { std::string bdev_path; if (!android::base::Realpath(path, &bdev_path)) { PLOG(ERROR) << "Failed to get realpath for " << path; return false; } for (const auto& entry : fstab) { std::string fstab_bdev_path; if (!android::base::Realpath(entry.blk_device, &fstab_bdev_path)) { PLOG(ERROR) << "Failed to get realpath for " << entry.blk_device; return false; } if (fstab_bdev_path == bdev_path) { return true; } } return false; } static int exec_cmd(const std::vector<std::string>& args) { CHECK(!args.empty()); auto argv = StringVectorToNullTerminatedArray(args); Loading Loading
install/install.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,19 @@ bool SetupPackageMount(const std::string& package_path, bool* should_use_fuse) { LOG(ERROR) << "Failed to mount " << block_map_path; return false; } auto block_map_data = BlockMapData::ParseBlockMapFile(block_map_path); if (!CheckPathCanonical(block_map_data.path())) { LOG(ERROR) << "Block map " << package_path << " contains non-canonical path " << block_map_data.path() << " abort installation."; return false; } if (!BlockDevHasFstab(block_map_data.path())) { LOG(ERROR) << "Block device " << block_map_path << " does not have corresponding fstab. This might be an external device, " "aborting installation."; return false; } // uncrypt only produces block map only if the package stays on /data. *should_use_fuse = false; return true; Loading
recovery_utils/include/recovery_utils/roots.h +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ Volume* volume_for_mount_point(const std::string& mount_point); // success (volume is mounted). int ensure_path_mounted(const std::string& path); // Return true if the block device has a corresponding entry // in fstab bool BlockDevHasFstab(const std::string& path); // Similar to ensure_path_mounted, but allows one to specify the mount_point. int ensure_path_mounted_at(const std::string& path, const std::string& mount_point); Loading
recovery_utils/roots.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <string> #include <vector> #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> Loading Loading @@ -90,6 +91,25 @@ int ensure_path_unmounted(const std::string& path) { return android::fs_mgr::EnsurePathUnmounted(&fstab, path) ? 0 : -1; } bool BlockDevHasFstab(const std::string& path) { std::string bdev_path; if (!android::base::Realpath(path, &bdev_path)) { PLOG(ERROR) << "Failed to get realpath for " << path; return false; } for (const auto& entry : fstab) { std::string fstab_bdev_path; if (!android::base::Realpath(entry.blk_device, &fstab_bdev_path)) { PLOG(ERROR) << "Failed to get realpath for " << entry.blk_device; return false; } if (fstab_bdev_path == bdev_path) { return true; } } return false; } static int exec_cmd(const std::vector<std::string>& args) { CHECK(!args.empty()); auto argv = StringVectorToNullTerminatedArray(args); Loading