Update OTA to understand SELinux filesystem labels

Make fs_config aware of SELinux contexts, and output the context
whenever we output the UID / GID / file perms.

Pass the selinux context to the set_perm2() and set_perm2_recursive()
calls. When the OTA script fixes up filesystem permissions, it will
also fix up the SELinux context on the files.

Bug: 8985290
Change-Id: I6419b64c06309a93ac6b2f2cf9fc7f8815adeaf3
This commit is contained in:
Nick Kralevich
2013-07-17 17:43:09 -07:00
parent 0a2c858bb6
commit fbbd79530a
5 changed files with 108 additions and 32 deletions

View File

@@ -217,14 +217,14 @@ class EdifyGenerator(object):
else:
raise ValueError("don't know how to write \"%s\" partitions" % (p.fs_type,))
def SetPermissions(self, fn, uid, gid, mode):
def SetPermissions(self, fn, uid, gid, mode, secontext):
"""Set file ownership and permissions."""
self.script.append('set_perm(%d, %d, 0%o, "%s");' % (uid, gid, mode, fn))
self.script.append('set_perm2(%d, %d, 0%o, "%s", "%s");' % (uid, gid, mode, secontext, fn))
def SetPermissionsRecursive(self, fn, uid, gid, dmode, fmode):
def SetPermissionsRecursive(self, fn, uid, gid, dmode, fmode, secontext):
"""Recursively set path ownership and permissions."""
self.script.append('set_perm_recursive(%d, %d, 0%o, 0%o, "%s");'
% (uid, gid, dmode, fmode, fn))
self.script.append('set_perm2_recursive(%d, %d, 0%o, 0%o, "%s", "%s");'
% (uid, gid, dmode, fmode, secontext, fn))
def MakeSymlinks(self, symlink_list):
"""Create symlinks, given a list of (dest, link) pairs."""