partitionmanager: Only create logical partition symlink when it doesn't exist

Legacy devices might have symlinks to real partitions in this folder.


Change-Id: I4d3360ff1022eabbd4f6ae7688d8bb7306ae9777
(cherry picked from commit 928234b2b704555073ab03eb6a051fa9c9fd2a86)
This commit is contained in:
me-cafebabe
2022-07-28 04:07:04 +08:00
committed by bigbiff
parent 1f79000a71
commit 808344f4ed
+4 -2
View File
@@ -3418,8 +3418,10 @@ bool TWPartitionManager::Prepare_Super_Volume(TWPartition* twrpPart) {
twrpPart->Update_Size(true);
twrpPart->Set_Can_Be_Backed_Up(false);
twrpPart->Set_Can_Be_Wiped(false);
LOGINFO("Symlinking %s => /dev/block/bootdevice/by-name/%s \n", fstabEntry.blk_device.c_str(), bare_partition_name.c_str());
symlink(fstabEntry.blk_device.c_str(), ("/dev/block/bootdevice/by-name/" + bare_partition_name).c_str());
if (access(("/dev/block/bootdevice/by-name/" + bare_partition_name).c_str(), F_OK) == -1) {
LOGINFO("Symlinking %s => /dev/block/bootdevice/by-name/%s \n", fstabEntry.blk_device.c_str(), bare_partition_name.c_str());
symlink(fstabEntry.blk_device.c_str(), ("/dev/block/bootdevice/by-name/" + bare_partition_name).c_str());
}
return true;
}