Support SELinux context label when mounting
If there is a SELinux context label in the recovery.fstab, we should
honor that when mounting the partition.
Bug: 19764039
Change-Id: Ic80a3377a5a94c9d10dd464eb1257b157a947510
(cherry picked from commit 548eb76c8f0e18d114ce4125905434c1c6920969)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index ceda0b9..a9a9a0b 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -177,9 +177,12 @@
if "=" in option:
key, value = option.split("=", 1)
mount_dict[key] = value
+ mount_flags = mount_dict.get(p.fs_type, "")
+ if p.context is not None:
+ mount_flags = p.context + ("," + mount_flags if mount_flags else "")
self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % (
p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device,
- p.mount_point, mount_dict.get(p.fs_type, "")))
+ p.mount_point, mount_flags))
self.mounts.add(p.mount_point)
def UnpackPackageDir(self, src, dst):