safetynet-fix/build.sh

35 lines
768 B
Bash
Raw Normal View History

2021-09-06 09:04:30 +00:00
#!/usr/bin/env bash
set -euo pipefail
2021-09-06 09:04:30 +00:00
build_mode="${1:-release}"
2021-09-06 09:04:30 +00:00
cd "$(dirname "$0")"
2021-09-06 09:04:30 +00:00
pushd zygisk/module
rm -fr libs
debug_mode=1
if [[ "$build_mode" == "release" ]]; then
debug_mode=0
fi
$HOME/code/android/sdk/ndk/21.4.7075529/ndk-build -j48 NDK_DEBUG=$debug_mode
2021-09-06 09:04:30 +00:00
popd
pushd java
2021-09-06 09:04:30 +00:00
# Must always be release due to R8 requirement
./gradlew assembleRelease
popd
mkdir -p magisk/zygisk
for arch in arm64-v8a armeabi-v7a x86 x86_64
do
cp "zygisk/module/libs/$arch/libsafetynetfix.so" "magisk/zygisk/$arch.so"
done
2021-09-06 09:04:30 +00:00
pushd magisk
2021-09-06 09:04:30 +00:00
version="$(grep '^version=' module.prop | cut -d= -f2)"
rm -f "../safetynet-fix-$version.zip" classes.dex
unzip "../java/app/build/outputs/apk/release/app-release.apk" "classes.dex"
zip -r9 "../safetynet-fix-$version.zip" .
popd