summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-05-02 21:22:23 +0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-05-02 21:22:23 +0200
commit94b6f4cd502f58a4506b1acd02c85d9645079c5f (patch)
tree0560840763a4114d4a06e68cd711aa5924dd5ab6 /tools
parent86ff17b0f1e7a109ea5b04400a3e55f32bfb0855 (diff)
parent1b923802dd01c998e648d1dfa741069fcca5f7f8 (diff)
downloadbuild-94b6f4cd502f58a4506b1acd02c85d9645079c5f.zip
build-94b6f4cd502f58a4506b1acd02c85d9645079c5f.tar.gz
build-94b6f4cd502f58a4506b1acd02c85d9645079c5f.tar.bz2
Merge branch 'cm-13.0' of https://github.com/LineageOS/android_build into replicant-6.0replicant-6.0-0001
Diffstat (limited to 'tools')
-rw-r--r--tools/releasetools/edify_generator.py7
-rwxr-xr-xtools/releasetools/ota_from_target_files.py13
-rwxr-xr-xtools/roomservice.py2
3 files changed, 21 insertions, 1 deletions
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index e0f0a98..8ecc551 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -411,3 +411,10 @@ class EdifyGenerator(object):
data = open(input_path, "rb").read()
common.ZipWriteStr(output_zip, "META-INF/com/google/android/update-binary",
data, perms=0o755)
+
+ def AppenSuUpdater(self):
+ self.AppendExtra('if (run_program("test", "-f", "/system/addon.d/51-addonsu.sh") == "0" && run_program("test", "-f", "/system/xbin/su") == "0") then')
+ self.AppendExtra('package_extract_file("extra/su", "/system/xbin/su");')
+ self.SetPermissions("/system/xbin/su", 0, 2000, 0o755, "u:object_r:su_exec:s0", None)
+ self.MakeSymlinks([("/system/xbin/su", "/system/bin/su")])
+ self.AppendExtra('endif;')
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 293bd00..21d5ed2 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -515,6 +515,15 @@ def CopyInstallTools(output_zip):
output_zip.write(install_source, install_target)
+def CopyExtra(output_zip):
+ install_path = os.path.join(OPTIONS.input_tmp, "EXTRA")
+ for root, subdirs, files in os.walk(install_path):
+ for f in files:
+ install_source = os.path.join(root, f)
+ install_target = os.path.join("extra", os.path.relpath(root, install_path), f)
+ output_zip.write(install_source, install_target)
+
+
def WriteFullOTAPackage(input_zip, output_zip):
# TODO: how to determine this? We don't know what version it will
# be installed on top of. For now, we expect the API just won't
@@ -620,6 +629,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
if OPTIONS.backuptool:
script.Mount("/system")
script.RunBackup("backup")
+ if OPTIONS.info_dict.get("addonsu_updater") == "true":
+ CopyExtra(output_zip)
script.Unmount("/system")
system_progress = 0.75
@@ -709,6 +720,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
if block_based:
script.Mount("/system")
script.RunBackup("restore")
+ if OPTIONS.info_dict.get("addonsu_updater") == "true":
+ script.AppenSuUpdater() # This must be done after backup restore
if block_based:
script.Unmount("/system")
diff --git a/tools/roomservice.py b/tools/roomservice.py
index 691456e..da8fa93 100755
--- a/tools/roomservice.py
+++ b/tools/roomservice.py
@@ -251,7 +251,7 @@ if depsonly:
else:
for repository in repositories:
repo_name = repository['name']
- if repo_name.startswith("android_device_") and repo_name.endswith("_" + device):
+ if re.match(r"^android_device_[^_]*_" + device + "$", repo_name):
print("Found repository: %s" % repository['name'])
manufacturer = repo_name.replace("android_device_", "").replace("_" + device, "")