forked from noiphonehere/android_device_samsung_galaxys4gmtd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreleasetools.py
82 lines (74 loc) · 4.45 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Copyright (C) 2012 The Android Open Source Project
# Copyright (C) 2012 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Custom OTA commands for aries"""
import common
import os
TARGET_DIR = os.getenv('OUT')
UTILITIES_DIR = os.path.join(TARGET_DIR, 'utilities')
def FullOTA_Assertions(info):
info.output_zip.write(os.path.join(TARGET_DIR, "modem.bin"), "modem.bin")
info.output_zip.write(os.path.join(TARGET_DIR, "modem.bin.telusgalaxys4gmtd"), "modem.bin.telusgalaxys4gmtd")
info.output_zip.write(os.path.join(TARGET_DIR, "post-install.sh"), "post-install.sh")
info.output_zip.write(os.path.join(TARGET_DIR, "updater.sh"), "updater.sh")
info.output_zip.write(os.path.join(UTILITIES_DIR, "make_ext4fs"), "make_ext4fs")
info.output_zip.write(os.path.join(UTILITIES_DIR, "busybox"), "busybox")
info.output_zip.write(os.path.join(UTILITIES_DIR, "flash_image"), "flash_image")
info.output_zip.write(os.path.join(UTILITIES_DIR, "erase_image"), "erase_image")
info.output_zip.write(os.path.join(UTILITIES_DIR, "bml_over_mtd"), "bml_over_mtd")
info.output_zip.write(os.path.join(TARGET_DIR, "bml_over_mtd.sh"), "bml_over_mtd.sh")
info.output_zip.write(os.path.join(TARGET_DIR, "ramdisk.img"), "ramdisk.img")
info.output_zip.write(os.path.join(TARGET_DIR, "ramdisk-recovery.img"), "ramdisk-recovery.img")
info.script.AppendExtra(
('package_extract_file("modem.bin", "/tmp/modem.bin");\n'
'set_metadata("/tmp/modem.bin", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("modem.bin.telusgalaxys4gmtd", "/tmp/modem.bin.telusgalaxys4gmtd");\n'
'set_metadata("/tmp/modem.bin.telusgalaxys4gmtd", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("post-install.sh", "/tmp/post-install.sh");\n'
'set_metadata("/tmp/post-install.sh", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("updater.sh", "/tmp/updater.sh");\n'
'set_metadata("/tmp/updater.sh", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("make_ext4fs", "/tmp/make_ext4fs");\n'
'set_metadata("/tmp/make_ext4fs", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("busybox", "/tmp/busybox");\n'
'set_metadata("/tmp/busybox", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("flash_image", "/tmp/flash_image");\n'
'set_metadata("/tmp/flash_image", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("erase_image", "/tmp/erase_image");\n'
'set_metadata("/tmp/erase_image", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("bml_over_mtd", "/tmp/bml_over_mtd");\n'
'set_metadata("/tmp/bml_over_mtd", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra(
('package_extract_file("bml_over_mtd.sh", "/tmp/bml_over_mtd.sh");\n'
'set_metadata("/tmp/bml_over_mtd.sh", "uid", 0, "gid", 0, "mode", 0777);'))
info.script.AppendExtra('package_extract_file("boot.img", "/tmp/boot.img");')
info.script.AppendExtra('package_extract_file("ramdisk.img", "/tmp/ramdisk.img");')
info.script.AppendExtra('package_extract_file("ramdisk-recovery.img", "/tmp/ramdisk-recovery.img");')
info.script.AppendExtra('assert(run_program("/tmp/updater.sh") == 0);')
def FullOTA_InstallEnd(info):
# Remove writing boot.img from script (we do it in updater.sh)
info.script.script = [cmd for cmd in info.script.script if not "write_raw_image" in cmd]
info.script.AppendExtra('ifelse(is_mounted("/system"), unmount("/system"));')
info.script.AppendExtra('run_program("/sbin/mount", "/system");')
info.script.AppendExtra('delete("/system/etc/init/rild.rc");')
info.script.AppendExtra('unmount("/system");')
info.script.AppendExtra('assert(run_program("/tmp/post-install.sh") == 0);')