Remove hardcode'd docker paths

This commit is contained in:
ave 2021-08-22 20:04:01 +03:00
parent b6f80bbee0
commit d139344274
2 changed files with 20 additions and 5 deletions

View file

@ -1,10 +1,26 @@
#!/bin/bash
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/

View file

@ -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)