From d139344274cf342df77985bdba99b3f81900e34e Mon Sep 17 00:00:00 2001 From: ave Date: Sun, 22 Aug 2021 20:04:01 +0300 Subject: [PATCH] Remove hardcode'd docker paths --- resources/patches/slashcommands/87202-pre.sh | 22 +++++++++++++++++--- resources/scripts/ctcci/ctcci.py | 3 +-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/patches/slashcommands/87202-pre.sh b/resources/patches/slashcommands/87202-pre.sh index f6500a01e5..0f4edf67af 100644 --- a/resources/patches/slashcommands/87202-pre.sh +++ b/resources/patches/slashcommands/87202-pre.sh @@ -1,10 +1,26 @@ #!/bin/bash -cd /opt/ctc/gitrepo/resources/patches/slashcommands/code +if [ -z "$DISTOK_FOLDER" ] +then + cd /opt/ctc/gitrepo/resources/patches/slashcommands/code +else + cd "$DISTOK_FOLDER/resources/patches/slashcommands/code" +fi + +if [ -z "$DISTOK_APKTOOL_COMMAND" ] +then + DISTOK_APKTOOL_COMMAND="java -jar /opt/ctc/tools/apktool.jar" +fi + +if [ -z "$DISTOK_DX_COMMAND" ] +then + DISTOK_DX_COMMAND="/lib/android-sdk/build-tools/debian/dx" +fi + chmod +x gradlew rm -rf build ./gradlew build cd build/libs -/lib/android-sdk/build-tools/debian/dx --dex --output ctccommands.apk ctccommands-1.0-SNAPSHOT.jar -java -jar /opt/ctc/tools/apktool.jar d ctccommands.apk +$DISTOK_DX_COMMAND --dex --output ctccommands.apk ctccommands-1.0-SNAPSHOT.jar +$DISTOK_APKTOOL_COMMAND d ctccommands.apk cp -r ctccommands/smali/* ${DISTOK_EXTRACTED_DISCORD_PATH}/smali/ \ No newline at end of file diff --git a/resources/scripts/ctcci/ctcci.py b/resources/scripts/ctcci/ctcci.py index 6feb7aef2d..0e0b59f10e 100755 --- a/resources/scripts/ctcci/ctcci.py +++ b/resources/scripts/ctcci/ctcci.py @@ -48,7 +48,7 @@ with open(os.path.join(REPO_FOLDER, "resources/patchport-state.json")) as f: VERSION = STATE["versioncode"] BASE_APK_PATH = os.path.join(WORK_FOLDER, f"discord-base-{VERSION}") -BASE_JAR_PATH = os.path.join(WORK_FOLDER, f"discord-base-jar") +BASE_JAR_PATH = os.path.join(WORK_FOLDER, f"discord-base-{VERSION}-jar") # Wipe and recreate the base jar folder if os.path.exists(BASE_JAR_PATH): shutil.rmtree(BASE_JAR_PATH) @@ -88,7 +88,6 @@ if not os.path.exists(BASE_JAR_PATH): subprocess.run(f"unzip -j {INPUT_FILE} *.dex -d {BASE_JAR_PATH}", shell=True, cwd=WORK_FOLDER) subprocess.run(f"{DEX2JAR_BIN} *.dex", shell=True, cwd=BASE_JAR_PATH) subprocess.run(f"zipmerge discord-base.jar classes*dex2jar.jar", shell=True, cwd=BASE_JAR_PATH) - subprocess.run(f"rm classes*dex2jar.jar *.dex", shell=True, cwd=BASE_JAR_PATH) # Copy the base cache to work on it shutil.copytree(BASE_APK_PATH, WORK_APK_PATH)