diff --git a/experiment/patch_apk.sh b/experiment/patch_apk.sh index 60851a8..6dd5162 100644 --- a/experiment/patch_apk.sh +++ b/experiment/patch_apk.sh @@ -6,8 +6,8 @@ PATCHER="${FOLDER}/../patcher/target/release/patcher" KEY_PASS='P@ssw0rd!' ANDROID_HOME=${ANDROID_HOME:-"${HOME}/Android/Sdk"} -ZIPALIGN="${ANDROID_HOME}/build-tools/34.0.0/zipalign" -APKSIGNER="${ANDROID_HOME}/build-tools/34.0.0/apksigner" +ZIPALIGN=${ZIPALIGN:-"${ANDROID_HOME}/build-tools/34.0.0/zipalign"} +APKSIGNER=${APKSIGNER:-"${ANDROID_HOME}/build-tools/34.0.0/apksigner"} APK_DIR="${1}" RES_DIR="${2}" @@ -21,6 +21,15 @@ if [ ! -d "${RES_DIR}" ]; then exit fi +if [ ! -f "${ZIPALIGN}" ]; then + echo "zipalign not found, please install 'build-tools;34.0.0' with `sdkmanager 'build-tools;34.0.0'` or call `ZIPALIGN=/path/to/zipalign bash ${0} /path/to/apk/dir /path/to/result/dir`" + exit +fi +if [ ! -f "${APKSIGNER}" ]; then + echo "apksigner not found, please install 'build-tools;34.0.0' with `sdkmanager 'build-tools;34.0.0'` or call `APKSIGNER=/path/to/zipalign bash ${0} /path/to/apk/dir /path/to/result/dir`" + exit +fi + if [ ! -f "${FOLDER}/kestore.key" ]; then keytool -genkeypair -validity 1000 -dname 'CN=SomeKey,O=SomeOne,C=FR' -keystore "${FOLDER}/kestore.key" -storepass "${KEY_PASS}" -keypass "${KEY_PASS}" -alias SignKey -keyalg RSA -v @@ -61,4 +70,5 @@ for lst in $(ls "${TMP_DIR}/apks/"); do worker "${lst}" & done -rm -rf "${TMP_DIR}" +# delating the file used by the workers might not be a good idea +#rm -rf "${TMP_DIR}"