ctcci: Instead of having one pre/post script, allow for separate pre-post scripts

uwu
This commit is contained in:
ave 2019-10-08 05:17:06 +03:00
parent 08986e926c
commit 77a2e8ae2f
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
2 changed files with 13 additions and 6 deletions

View file

@ -82,6 +82,13 @@ shutil.copytree(BASE_APK_PATH, WORK_APK_PATH)
# Go through patches and apply every single one of them
for patch_name in PATCHES:
pre_script = os.path.join(REPO_FOLDER, "patches",
patch_name, f"{VERSION}-pre.sh")
if os.path.exists(pre_script):
subprocess.run(f"bash {pre_script}",
shell=True,
cwd=WORK_APK_PATH)
# Apply custom emoji patches
if patch_name in ["mutant", "blobs"]:
print(f"Applying {patch_name} emoji patch")
@ -207,12 +214,12 @@ for patch_name in PATCHES:
else:
patch(patch_file, WORK_APK_PATH, patch_name)
patch_script = os.path.join(REPO_FOLDER, "patches",
patch_name, f"{VERSION}.sh")
if os.path.exists(patch_script):
subprocess.run(f"bash {patch_script}",
shell=True,
cwd=WORK_APK_PATH)
post_script = os.path.join(REPO_FOLDER, "patches",
patch_name, f"{VERSION}-post.sh")
if os.path.exists(post_script):
subprocess.run(f"bash {post_script}",
shell=True,
cwd=WORK_APK_PATH)
# Pack the APK
subprocess.run(f"{APKTOOL_BIN} b discord",