From c9f6835a3a63102347d899722e1469398998d1b3 Mon Sep 17 00:00:00 2001 From: Ave Date: Mon, 25 May 2020 03:19:19 +0300 Subject: [PATCH] Drop more dependencies on /home/ave/ --- BUILDING.md | 12 ++++++++++-- ctcci/ctcci.py | 2 ++ patches/blobs/emojireplace.py | 8 +++----- patches/mutant/emojireplace.py | 8 +++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index b8f6a267f3..c9f0cf0e7c 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -8,7 +8,8 @@ - If you want Mutant Standard emoji patches, get 72x72 PNG copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). - If you want Blob emoji patches, get 72x72 PNG copies of blobmojis with codepoints. I personally resized the png/128 folder in this [repo](https://github.com/C1710/blobmoji) (`find /home/ave/blobmoji/png/72 -iname '*.png' -exec convert \{\} -verbose -resize 72x72\> \{\} \;`). - Extract the emojis you got somewhere. -- Clone this repo somewhere, edit `patches/mutant/emojireplace.py` and `patches/blobs/emojireplace.py`, set the `extracted_mutstd_path` and `extracted_blobmoji_path` folders respectively to the folder you just extracted emojis to. +- Clone this repo somewhere. +- Set your environment variables (see below), put them to somewhere where they'll persist (like your .bashrc/.zshrc, or preferably a build script). - Get a Discord apk (*cough* [apkmirror](https://www.apkmirror.com/apk/discord-inc/discord-chat-for-gamers/), [aptoide API](https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord)). ### Using CutTheCord CI @@ -25,9 +26,16 @@ CTCCI requires python3.6+, and also likely requires Linux (I haven't tried it on - If you don't want to always automatically be required to use the latest discord version, set `LOCAL_STATE` to `True` and point `STATE_FILE` to a `state.json` file that looks like this: `{"android": {"com.discord": {"version": 909}}}`. - Set up a local distok-style file storage for your APKs, and copy your APKs on it, and name them properly (the format is `$DISTOK_FOLDER/android/$PACKAGE_ID-$VERSION_NUMBER.apk`, example: `/home/ave/distok/android/com.discord-909.apk`). +#### Environment Variables + +- `DISTOK_VERSION_LOGS` (required, default: `"/root/distokrepos/versionlogs/"`): Should point to an empty directory (such as `export DISTOK_VERSION_LOGS="/home/ave/distokversionlogs"`). This directory will hold versions that will increase with each build. This is a hack that I need to eventually re-design, preferably move to a json file etc. +- `DISTOK_EMOJI_MUTANT` (optional, default: `"/root/distokfiles/mutant/72x72"`): Folder with the mutant emoji files. This should be set if you're going to be enabling the mutant emoji patches. +- `DISTOK_EMOJI_BLOBMOJI` (optional, default: `"/root/distokfiles/blobmoji/png/72"`): Folder with the blobmoji files. This should be set if you're going to be enabling the blobmoji patches. +- `DISTOK_EXTRACTED_DISCORD_PATH` (complicated, default: `"/tmp/cutthecord/discord"`): Directory at which your extracted discord files reside. This is required on manual builds, but will be overriden by ctcci with `WORK_APK_PATH` if ctcci is being used. + #### Running builds -- First off, if you're not running as root (you shouldn't!), set an environment variable called `DISTOK_VERSION_LOGS` to an empty directory (such as `export DISTOK_VERSION_LOGS="/home/ave/distokversionlogs"`). This directory will hold versions that will increase. This is a hack that I need to eventually improve. +- Firstly, ensure that you properly set your environment variables! - Simply run the `ctcci.py` script, with first argument being branch name, and latter ones being name of patches you want to add in. Example: `python3.6 /home/ave/distokrepos/cutthecord/ctcci/ctcci.py ave mutant customfont slashcommands tokenlogin customtheme customdefaultemoji customring bettertm notrack noprofilestrip nonearby experiments noblocked squareavatars` diff --git a/ctcci/ctcci.py b/ctcci/ctcci.py index e69296f869..980d69e7fa 100644 --- a/ctcci/ctcci.py +++ b/ctcci/ctcci.py @@ -34,6 +34,8 @@ def patch(patch_file, workdir, patch_name=""): if os.path.exists(WORK_APK_PATH): shutil.rmtree(WORK_APK_PATH) +os.environ["DISTOK_EXTRACTED_DISCORD_PATH"] = WORK_APK_PATH + os.makedirs(WORK_FOLDER, exist_ok=True) if LOCAL_STATE: diff --git a/patches/blobs/emojireplace.py b/patches/blobs/emojireplace.py index 8f84611f24..9248272d3d 100644 --- a/patches/blobs/emojireplace.py +++ b/patches/blobs/emojireplace.py @@ -2,11 +2,9 @@ import os import shutil -# REPLACE THESE LINES -# extracted_discord_path = "/home/ave/workbench/ctc/com.discord-896" -# extracted_blobmoji_path = "/home/ave/workbench/blobmoji/png/72" -extracted_discord_path = "/tmp/cutthecord/discord" -extracted_blobmoji_path = "/home/ave/blobmoji/png/72" +# You'll likely want to edit these lines or set DISTOK_EXTRACTED_DISCORD_PATH and DISTOK_EMOJI_BLOBMOJI +extracted_discord_path = os.environ.get("DISTOK_EXTRACTED_DISCORD_PATH", "/tmp/cutthecord/discord") +extracted_blobmoji_path = os.environ.get("DISTOK_EMOJI_BLOBMOJI", "/root/distokfiles/blobmoji/png/72") def clean_emoji_name(name): diff --git a/patches/mutant/emojireplace.py b/patches/mutant/emojireplace.py index 55a6e01fe2..8cca5e948f 100644 --- a/patches/mutant/emojireplace.py +++ b/patches/mutant/emojireplace.py @@ -3,11 +3,9 @@ import os import re import shutil -# REPLACE THESE LINES -# extracted_discord_path = "/home/ave/Downloads/dic/com.discord-832" -# extracted_mutstd_path = "/home/ave/Downloads/dic/72x72" -extracted_discord_path = "/tmp/cutthecord/discord" -extracted_mutstd_path = "/var/www/mutant/72x72" +# You'll likely want to edit these lines or set DISTOK_EXTRACTED_DISCORD_PATH and DISTOK_EMOJI_MUTANT +extracted_discord_path = os.environ.get("DISTOK_EXTRACTED_DISCORD_PATH", "/tmp/cutthecord/discord") +extracted_blobmoji_path = os.environ.get("DISTOK_EMOJI_MUTANT", "/root/distokfiles/mutant/72x72") # Add your custom emojis here