check tools are available

This commit is contained in:
Jean-Marie Mineau 2025-06-13 18:30:58 +02:00
parent 88eb6c4a19
commit 87057f3122
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2

View file

@ -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}"