Add instructions & remove jq dependency
This commit is contained in:
parent
e3025d8e94
commit
a4a02109af
|
@ -0,0 +1,58 @@
|
||||||
|
## [CutTheCord][] patcher
|
||||||
|
|
||||||
|
### Requires
|
||||||
|
|
||||||
|
- `bash`
|
||||||
|
- `coreutils`
|
||||||
|
- `sed`
|
||||||
|
- `patch`
|
||||||
|
- `git`
|
||||||
|
- `curl`
|
||||||
|
- `apktool`
|
||||||
|
- `keytool`
|
||||||
|
- `jarsigner`
|
||||||
|
- `adb` (optional if `SKIP_INSTALL` is set)
|
||||||
|
|
||||||
|
### Patches
|
||||||
|
|
||||||
|
- `bettertm`
|
||||||
|
- `branding`
|
||||||
|
- `customfont` ([text][Asap], [code][Hasklig])
|
||||||
|
- `customversion`
|
||||||
|
- `necessary`
|
||||||
|
- `noblocked`
|
||||||
|
- `notrack`
|
||||||
|
- `squareavatars`
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
The script needs a keystore to sign the patched app.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# the path to a .keystore or .jks file
|
||||||
|
export KEYSTORE_PATH="ctc-key.jks"
|
||||||
|
# the alias of the keystore
|
||||||
|
export KEYSTORE_ALIAS="ctc-key"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the file doesn't exist, generate it with `keytool`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
keytool -genkeypair \
|
||||||
|
-keystore "$KEYSTORE_PATH" \
|
||||||
|
-alias "$KEYSTORE_ALIAS"
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, you can run the script.<br>You will
|
||||||
|
be prompted to enter the keystore password.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bash < <(curl -LSs https://ikl.sh/ctc-patcher)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can install the patched app manually by setting `SKIP_INSTALL`
|
||||||
|
before running the script.<br>You will find it in `com.discord-*/dist/`.
|
||||||
|
|
||||||
|
[CutTheCord]: https://gitdab.com/distok/cutthecord
|
||||||
|
[Asap]: https://fonts.google.com/specimen/Asap
|
||||||
|
[Hasklig]: https://github.com/i-tu/Hasklig
|
20
patch.sh
20
patch.sh
|
@ -17,13 +17,13 @@ set -euo pipefail
|
||||||
|
|
||||||
URL='https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord'
|
URL='https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord'
|
||||||
|
|
||||||
readarray -t data < <(curl -Ssf "$URL" | jq -r '.data.file | "\(.vercode)\n\(.path)"')
|
[[ $(curl -Ssf "$URL") =~ \"vercode\":([0-9]+),.*\"path\":\"([^\"]+)\" ]]
|
||||||
|
|
||||||
discord="com.discord-${data[0]}"
|
discord="com.discord-${BASH_REMATCH[1]}"
|
||||||
|
|
||||||
printf 'Downloading %s...\n' "${data[1]}"
|
printf 'Downloading %s...\n' "${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
curl -L#fo "$discord.apk" "${data[1]}"
|
curl --progress-bar -Lfo "$discord.apk" "${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
apktool d "$discord.apk" -o "$discord"
|
apktool d "$discord.apk" -o "$discord"
|
||||||
|
|
||||||
|
@ -31,20 +31,20 @@ git clone --depth=1 https://gitdab.com/distok/cutthecord
|
||||||
|
|
||||||
printf 'Editing patches...\n'
|
printf 'Editing patches...\n'
|
||||||
|
|
||||||
sed -i cutthecord/patches/squareavatars/"${data[0]}".patch -e 's/3dp/5dp/'
|
sed -i cutthecord/patches/squareavatars/"${BASH_REMATCH[1]}".patch -e 's/3dp/5dp/'
|
||||||
sed -i cutthecord/patches/branding/"${data[0]}".patch \
|
sed -i cutthecord/patches/branding/"${BASH_REMATCH[1]}".patch \
|
||||||
-e 's/CTCNAME/Discord (CTC)/g;s/CTCBRANCH/chronobserver/g' \
|
-e 's/CTCNAME/Discord (CTC)/g;s/CTCBRANCH/chronobserver/g' \
|
||||||
-e "s/-CTCBUILD/-$(date --iso-8601)/g;s/CTCBUILD//g"
|
-e "s/-CTCBUILD/-$(date --iso-8601)/g;s/CTCBUILD//g"
|
||||||
sed -i cutthecord/patches/branding/customicon.sh -e 's/#rm/rm/'
|
sed -i cutthecord/patches/branding/customicon.sh -e 's/#rm/rm/'
|
||||||
|
|
||||||
for p in necessary notrack noblocked squareavatars branding customversion; do
|
for p in necessary notrack noblocked squareavatars branding customversion; do
|
||||||
patch -d "$discord" -p1 < cutthecord/patches/"$p"/"${data[0]}".patch
|
patch -d "$discord" -p1 < "cutthecord/patches/$p/${BASH_REMATCH[1]}.patch"
|
||||||
done
|
done
|
||||||
|
|
||||||
printf 'Replacing files...\n'
|
printf 'Replacing files...\n'
|
||||||
|
|
||||||
pushd "$discord" >/dev/null
|
pushd "$discord" >/dev/null
|
||||||
bash ../cutthecord/patches/notrack/"${data[0]}"-post.sh
|
bash ../cutthecord/patches/notrack/"${BASH_REMATCH[1]}"-post.sh
|
||||||
bash ../cutthecord/patches/branding/customicon.sh
|
bash ../cutthecord/patches/branding/customicon.sh
|
||||||
bash ../cutthecord/patches/branding/customdynamicicon.sh
|
bash ../cutthecord/patches/branding/customdynamicicon.sh
|
||||||
bash ../cutthecord/patches/bettertm/bettertm.sh ../cutthecord/patches/bettertm
|
bash ../cutthecord/patches/bettertm/bettertm.sh ../cutthecord/patches/bettertm
|
||||||
|
@ -61,7 +61,9 @@ curl -LSsfo "$discord"/res/font/sourcecodepro_semibold.ttf \
|
||||||
|
|
||||||
apktool b "$discord"
|
apktool b "$discord"
|
||||||
|
|
||||||
jarsigner -keystore "$KEYSTORE_PATH" "$discord/dist/$discord.apk" "$KEYSTORE_ALIAS"
|
while ! jarsigner -keystore "$KEYSTORE_PATH" \
|
||||||
|
"$discord/dist/$discord.apk" "$KEYSTORE_ALIAS"
|
||||||
|
do :; done
|
||||||
|
|
||||||
if [[ -z ${SKIP_INSTALL+x} ]]; then
|
if [[ -z ${SKIP_INSTALL+x} ]]; then
|
||||||
adb install -r "$discord/dist/$discord.apk"
|
adb install -r "$discord/dist/$discord.apk"
|
||||||
|
|
Reference in New Issue