From c3e1a54ff915306de3bf7e34a9f73aa84ca6e763 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Tue, 26 Nov 2019 21:21:08 +0300 Subject: [PATCH] ctcci: add apksigner support --- ctcci/ctcci.py | 16 ++++++++++++---- ctcci/ctcconfig.example.py | 3 +++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ctcci/ctcci.py b/ctcci/ctcci.py index 0162f90..b2c2c5c 100644 --- a/ctcci/ctcci.py +++ b/ctcci/ctcci.py @@ -230,10 +230,18 @@ APK_PATH = os.path.join(WORK_FOLDER, "discord", "dist", f"{PACKAGE_ID}-{VERSION}.apk") # Sign the APK -subprocess.run(f"jarsigner -storepass {KEYSTORE_PASS} -keystore " - f"{KEYSTORE_FILE} {APK_PATH} {KEYSTORE_ALIAS}", - shell=True, - cwd=WORK_FOLDER) +if DO_APKSIGNER: + subprocess.run(f"apksigner sign --ks {KEYSTORE_FILE}" + f"--ks-key-alias {KEYSTORE_ALIAS} " + f"--ks-pass pass:{KEYSTORE_PASS}" + f"{APK_PATH}", + shell=True, + cwd=WORK_FOLDER) +else: + subprocess.run(f"jarsigner -storepass {KEYSTORE_PASS} -keystore " + f"{KEYSTORE_FILE} {APK_PATH} {KEYSTORE_ALIAS}", + shell=True, + cwd=WORK_FOLDER) # Copy the result file shutil.copyfile(APK_PATH, OUTPUT_FILE) diff --git a/ctcci/ctcconfig.example.py b/ctcci/ctcconfig.example.py index 893a91e..2350f5a 100644 --- a/ctcci/ctcconfig.example.py +++ b/ctcci/ctcconfig.example.py @@ -23,6 +23,9 @@ RESULT_FOLDER = FDROID_FOLDER + "/repo" DO_GITPULL = True REPO_FOLDER = "/home/ave/distokrepos/cutthecord" +# If false, jarsigner will be used for signing the apk. +DO_APKSIGNER = False + # Keystore file, alias and pass. Required. KEYSTORE_FILE = "/home/ave/oof.keystore" KEYSTORE_ALIAS = "distok"