Create/Remove system_root/system bind mount, when mounting System

This will automatically create and remove a bind mount
/system -> /system_root/system
everytime "System" is mounted via the GUI or ORS.
This should get rid of issues with ZIPs trying to mount
the system-partition to /system on SAR-devices, while keeping
the filesystem-layout in sync with AOSP from a user-perspective.

Change-Id: I7f531d113b07c31b39d8f87edac76a7fc79075e7
This commit is contained in:
Chaosmaster
2020-05-10 15:43:55 -04:00
committed by bigbiff
parent ff4f958182
commit da97480567
+13
View File
@@ -1528,10 +1528,23 @@ bool TWPartition::Mount(bool Display_Error) {
string Command = "mount -o bind '" + Symlink_Path + "' '" + Symlink_Mount_Point + "'";
TWFunc::Exec_Cmd(Command);
}
if (Mount_Point == "/system_root") {
unlink("/system");
mkdir("/system", 0755);
mount("/system_root/system", "/system", "auto", MS_BIND, NULL);
}
return true;
}
bool TWPartition::UnMount(bool Display_Error) {
if (Mount_Point == "/system_root") {
if (umount("/system") == -1)
umount2("/system", MNT_DETACH);
rmdir("/system");
symlink("/system_root/system", "/system");
}
if (Is_Mounted()) {
int never_unmount_system;