Last active
January 23, 2026 22:23
-
-
Save amiv1/75481a6fb43b7f8d09aa73fd02e5fe8a to your computer and use it in GitHub Desktop.
Script to patch an APK using Morphe CLI tool: https://github.com/MorpheApp/morphe-cli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # This script automatically pulls morphe-cli and morphe-patches source code. | |
| # Then builds and runs morphe-cli with necessary dependencies for APK patching. | |
| # | |
| # Requirements: git, openjdk 11, openjdk 17 | |
| # | |
| # Usage: ./morphe-patch.sh your-app.apk | |
| # You can also provide any additional options supported by morphe-cli | |
| # See usage docs for more details https://github.com/MorpheApp/morphe-cli/blob/main/docs/1_usage.md | |
| set -e | |
| if [ ! -d morphe-cli ]; then | |
| git clone https://github.com/MorpheApp/morphe-cli.git | |
| fi | |
| if [ ! -d morphe-patches ]; then | |
| git clone https://github.com/MorpheApp/morphe-patches.git | |
| fi | |
| echo "\n## Building morphe-cli ##\n" | |
| cd morphe-cli | |
| git fetch | |
| MORPHE_CLI_VERSION="$(git tag -l --sort=-creatordate | grep -v '-' | head -n 1)" | |
| git checkout "$MORPHE_CLI_VERSION" | |
| ./gradlew cleanShadowJar shadowJar | |
| cd .. | |
| echo "\n## Building morphe-patches ##\n" | |
| cd morphe-patches | |
| git fetch | |
| MORPHE_PATCHES_VERSION="$(git tag -l --sort=-creatordate | grep -v '-' | head -n 1)" | |
| git checkout "$MORPHE_PATCHES_VERSION" | |
| ./gradlew cleanJar jar | |
| cd .. | |
| echo "\n## Running morphe-cli ##\n" | |
| java -jar "morphe-cli/build/libs/morphe-cli-${MORPHE_CLI_VERSION##*v}-all.jar" patch \ | |
| --patches="morphe-patches/patches/build/libs/patches-${MORPHE_PATCHES_VERSION##*v}.mpp" \ | |
| --keystore=morphe.keystore \ | |
| --temporary-files-path=/tmp/morphe/ \ | |
| --keystore-entry-alias='Key' \ | |
| --disable='Custom branding' \ | |
| --purge \ | |
| "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment