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

Commit 69d798b5 authored by Mark Salyzyn's avatar Mark Salyzyn Committed by android-build-merger
Browse files

Merge "adb: overlayfs failed to remount /system" am: 7d87981f am: 503611b6

am: 97702abf

Change-Id: I3fa32948a6644d826467c505f8d7e27ad1d1c9e8
parents a754a2e6 97702abf
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -97,8 +97,12 @@ static std::string find_mount(const char* dir, bool is_root) {
    }
    }
}
}


bool dev_is_overlayfs(const std::string& dev) {
    return (dev == "overlay") || (dev == "overlayfs");
}

bool make_block_device_writable(const std::string& dev) {
bool make_block_device_writable(const std::string& dev) {
    if ((dev == "overlay") || (dev == "overlayfs")) return true;
    if (dev_is_overlayfs(dev)) return true;
    int fd = unix_open(dev.c_str(), O_RDONLY | O_CLOEXEC);
    int fd = unix_open(dev.c_str(), O_RDONLY | O_CLOEXEC);
    if (fd == -1) {
    if (fd == -1) {
        return false;
        return false;
@@ -161,6 +165,10 @@ static bool remount_partition(int fd, const char* dir) {
        return true;
        return true;
    }
    }
    bool is_root = strcmp(dir, "/") == 0;
    bool is_root = strcmp(dir, "/") == 0;
    if (is_root && dev_is_overlayfs(find_mount("/system", false))) {
        dir = "/system";
        is_root = false;
    }
    std::string dev = find_mount(dir, is_root);
    std::string dev = find_mount(dir, is_root);
    if (is_root && dev.empty()) {
    if (is_root && dev.empty()) {
        // The fstab entry will be /system if the device switched roots during
        // The fstab entry will be /system if the device switched roots during
+2 −3
Original line number Original line Diff line number Diff line
@@ -274,9 +274,8 @@ H=`echo "${D}" | head -1` &&
  echo "${D}" | grep "^overlay .* /system\$" >/dev/null ||
  echo "${D}" | grep "^overlay .* /system\$" >/dev/null ||
  die  "overlay takeover after remount"
  die  "overlay takeover after remount"
!(adb_sh grep "^overlay " /proc/mounts </dev/null | grep " overlay ro,") &&
!(adb_sh grep "^overlay " /proc/mounts </dev/null | grep " overlay ro,") &&
  !(adb_sh grep " rw," /proc/mounts </dev/null |
  !(adb_sh grep " rw," /proc/mounts </dev/null | skip_administrative_mounts) ||
  skip_administrative_mounts) ||
  die "remount overlayfs missed a spot (ro)"
    die "remount overlayfs missed a spot"


adb_su "sed -n '1,/overlay \\/system/p' /proc/mounts" </dev/null |
adb_su "sed -n '1,/overlay \\/system/p' /proc/mounts" </dev/null |
  skip_administrative_mounts |
  skip_administrative_mounts |