Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a7d3723 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge remote-tracking branch 'origin/lineage-23.0' into a16

parents d6afd9f1 ebc617e9
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -829,28 +829,15 @@ bool SetupPackageMount(const std::string& package_path, bool* should_use_fuse) {
  *should_use_fuse = true;
  if (package_path[0] == '@') {
    auto block_map_path = package_path.substr(1);
    if (!CheckPathCanonical(block_map_path)) {
      LOG(ERROR) << "Block map path " << package_path << " not canonical, abort installation.";
      return false;
    }

    if (ensure_path_mounted(block_map_path) != 0) {
      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.";

    if (!CheckPathCanonical(block_map_path)) {
      LOG(ERROR) << "Block map path " << package_path << " not canonical, abort installation.";
      return false;
    }

    // uncrypt only produces block map only if the package stays on /data.
    *should_use_fuse = false;
    return true;
+0 −4
Original line number Diff line number Diff line
@@ -32,10 +32,6 @@ 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);

+0 −20
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <string>
#include <vector>

#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@@ -167,25 +166,6 @@ int ensure_volume_unmounted(const std::string& blk_device) {
  return 0;
}

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);