Loading tools/releasetools/common.py +12 −2 Original line number Original line Diff line number Diff line Loading @@ -202,12 +202,13 @@ def LoadDictionaryFromLines(lines): def LoadRecoveryFSTab(read_helper, fstab_version): def LoadRecoveryFSTab(read_helper, fstab_version): class Partition(object): class Partition(object): def __init__(self, mount_point, fs_type, device, length, device2): def __init__(self, mount_point, fs_type, device, length, device2, context): self.mount_point = mount_point self.mount_point = mount_point self.fs_type = fs_type self.fs_type = fs_type self.device = device self.device = device self.length = length self.length = length self.device2 = device2 self.device2 = device2 self.context = context try: try: data = read_helper("RECOVERY/RAMDISK/etc/recovery.fstab") data = read_helper("RECOVERY/RAMDISK/etc/recovery.fstab") Loading Loading @@ -256,6 +257,7 @@ def LoadRecoveryFSTab(read_helper, fstab_version): line = line.strip() line = line.strip() if not line or line.startswith("#"): if not line or line.startswith("#"): continue continue # <src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> pieces = line.split() pieces = line.split() if len(pieces) != 5: if len(pieces) != 5: raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,)) raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,)) Loading @@ -275,9 +277,17 @@ def LoadRecoveryFSTab(read_helper, fstab_version): # Ignore all unknown options in the unified fstab # Ignore all unknown options in the unified fstab continue continue mount_flags = pieces[3] # Honor the SELinux context if present. context = None for i in mount_flags.split(","): if i.startswith("context="): context = i mount_point = pieces[1] mount_point = pieces[1] d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2], d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2], device=pieces[0], length=length, device2=None) device=pieces[0], length=length, device2=None, context=context) else: else: raise ValueError("Unknown fstab_version: \"%d\"" % (fstab_version,)) raise ValueError("Unknown fstab_version: \"%d\"" % (fstab_version,)) Loading tools/releasetools/edify_generator.py +4 −1 Original line number Original line Diff line number Diff line Loading @@ -177,9 +177,12 @@ class EdifyGenerator(object): if "=" in option: if "=" in option: key, value = option.split("=", 1) key, value = option.split("=", 1) mount_dict[key] = value 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");' % ( self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % ( p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device, 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) self.mounts.add(p.mount_point) def UnpackPackageDir(self, src, dst): def UnpackPackageDir(self, src, dst): Loading Loading
tools/releasetools/common.py +12 −2 Original line number Original line Diff line number Diff line Loading @@ -202,12 +202,13 @@ def LoadDictionaryFromLines(lines): def LoadRecoveryFSTab(read_helper, fstab_version): def LoadRecoveryFSTab(read_helper, fstab_version): class Partition(object): class Partition(object): def __init__(self, mount_point, fs_type, device, length, device2): def __init__(self, mount_point, fs_type, device, length, device2, context): self.mount_point = mount_point self.mount_point = mount_point self.fs_type = fs_type self.fs_type = fs_type self.device = device self.device = device self.length = length self.length = length self.device2 = device2 self.device2 = device2 self.context = context try: try: data = read_helper("RECOVERY/RAMDISK/etc/recovery.fstab") data = read_helper("RECOVERY/RAMDISK/etc/recovery.fstab") Loading Loading @@ -256,6 +257,7 @@ def LoadRecoveryFSTab(read_helper, fstab_version): line = line.strip() line = line.strip() if not line or line.startswith("#"): if not line or line.startswith("#"): continue continue # <src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> pieces = line.split() pieces = line.split() if len(pieces) != 5: if len(pieces) != 5: raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,)) raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,)) Loading @@ -275,9 +277,17 @@ def LoadRecoveryFSTab(read_helper, fstab_version): # Ignore all unknown options in the unified fstab # Ignore all unknown options in the unified fstab continue continue mount_flags = pieces[3] # Honor the SELinux context if present. context = None for i in mount_flags.split(","): if i.startswith("context="): context = i mount_point = pieces[1] mount_point = pieces[1] d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2], d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2], device=pieces[0], length=length, device2=None) device=pieces[0], length=length, device2=None, context=context) else: else: raise ValueError("Unknown fstab_version: \"%d\"" % (fstab_version,)) raise ValueError("Unknown fstab_version: \"%d\"" % (fstab_version,)) Loading
tools/releasetools/edify_generator.py +4 −1 Original line number Original line Diff line number Diff line Loading @@ -177,9 +177,12 @@ class EdifyGenerator(object): if "=" in option: if "=" in option: key, value = option.split("=", 1) key, value = option.split("=", 1) mount_dict[key] = value 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");' % ( self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % ( p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device, 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) self.mounts.add(p.mount_point) def UnpackPackageDir(self, src, dst): def UnpackPackageDir(self, src, dst): Loading