forked from X-s/patchrom_miui_oneplus_bacon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
releasetools.py
47 lines (40 loc) · 1.35 KB
/
releasetools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import common
import edify_generator
def RemoveDeviceAssert(info):
edify = info.script
for i in xrange(len(edify.script)):
if "assert" in edify.script[i]:
edify.script[i] = ''
return
def RemoveDeviceGetprop(info):
edify = info.script
for i in xrange(len(edify.script)):
if "getprop" in edify.script[i]:
edify.script[i] = ''
return
def MountSystem(info):
edify = info.script
for i in xrange(len(edify.script)):
if "unmount(" in edify.script[i] and "/system" in edify.script[i]:
edify.script[i] = 'mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");'
return
def DeleteSystem(info):
edify = info.script
for i in xrange(len(edify.script)):
if "format(" in edify.script[i] and "/dev/block/platform/msm_sdcc.1/by-name/system" in edify.script[i]:
edify.script[i] = 'delete_recursive("/system");'
return
def WritePolicyConfig(info):
try:
file_contexts = info.input_zip.read("META/file_contexts")
common.ZipWriteStr(info.output_zip, "file_contexts", file_contexts)
except KeyError:
print "warning: file_context missing from target;"
def FullOTA_InstallEnd(info):
RemoveDeviceGetprop(info)
MountSystem(info)
DeleteSystem(info)
WritePolicyConfig(info)
def IncrementalOTA_InstallEnd(info):
RemoveDeviceAssert(info)
RemoveDeviceGetprop(info)