From 1f69ccf3015f7159e52755f02e7e52dd83e8f026 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Fri, 13 Dec 2019 12:38:55 +0300 Subject: [PATCH] Add a post-script to notrack and make pre/post scripts automatically get ported --- patches/notrack/1006-post.sh | 3 +++ patchport.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 patches/notrack/1006-post.sh diff --git a/patches/notrack/1006-post.sh b/patches/notrack/1006-post.sh new file mode 100755 index 0000000..7e5b5b4 --- /dev/null +++ b/patches/notrack/1006-post.sh @@ -0,0 +1,3 @@ +#!/bin/bash +mv smali/com/crashlytics smali_classes2/com/ +mv smali/com/facebook smali_classes2/com/ diff --git a/patchport.py b/patchport.py index 335e776..e4d8845 100644 --- a/patchport.py +++ b/patchport.py @@ -124,6 +124,15 @@ for patch in os.listdir(os.path.join(cutthecord_folder, "patches")): print(f"patch is not a folder, skipping: {patch}") continue + pre_in_path = os.path.join(cutthecord_folder, "patches", patch, + f"{from_versioncode}-pre.sh") + post_in_path = os.path.join(cutthecord_folder, "patches", patch, + f"{from_versioncode}-post.sh") + pre_out_path = os.path.join(cutthecord_folder, "patches", patch, + f"{to_versioncode}-pre.sh") + post_out_path = os.path.join(cutthecord_folder, "patches", patch, + f"{to_versioncode}-post.sh") + patch_path = os.path.join(cutthecord_folder, "patches", patch, f"{from_versioncode}.patch") out_path = os.path.join(cutthecord_folder, "patches", patch, @@ -149,6 +158,16 @@ for patch in os.listdir(os.path.join(cutthecord_folder, "patches")): print(f"SKIPPED: No {from_versionname} version found for {patch}.") continue + # Check if pre-script exists, if it does copy it + if os.path.isfile(pre_in_path): + shutil.copyfile(pre_in_path, pre_out_path) + print(f"PRE COPIED: {patch}'s pre script was copied.") + + # Check if post-script exists, if it does copy it + if os.path.isfile(post_in_path): + shutil.copyfile(post_in_path, post_out_path) + print(f"POST COPIED: {patch}'s post script was copied.") + # Create necessary instead of porting it. if patch == "necessary": patch_contents = make_necessary(to_versioncode, to_versionname)