2021-09-06 09:04:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-10-31 00:50:11 +00:00
|
|
|
set -euo pipefail
|
2021-09-06 09:04:30 +00:00
|
|
|
|
2021-10-31 00:50:11 +00:00
|
|
|
build_mode="${1:-release}"
|
2021-09-06 09:04:30 +00:00
|
|
|
|
2021-10-31 00:50:11 +00:00
|
|
|
cd "$(dirname "$0")"
|
2021-09-06 09:04:30 +00:00
|
|
|
|
2021-10-31 00:50:11 +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
|
|
|
|
|
2021-10-31 00:50:11 +00:00
|
|
|
pushd java_module
|
2021-09-06 09:04:30 +00:00
|
|
|
# Must always be release due to R8 requirement
|
|
|
|
./gradlew assembleRelease
|
|
|
|
popd
|
|
|
|
|
2021-10-31 00:50:11 +00:00
|
|
|
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
|
|
|
|
2021-10-31 00:50:11 +00:00
|
|
|
pushd magisk
|
2021-09-06 09:04:30 +00:00
|
|
|
version="$(grep '^version=' module.prop | cut -d= -f2)"
|
2021-10-31 00:50:11 +00:00
|
|
|
rm -f "../safetynet-fix-$version.zip" classes.dex
|
|
|
|
unzip "../java_module/app/build/outputs/apk/release/app-release.apk" "classes.dex"
|
|
|
|
zip -r9 "../safetynet-fix-$version.zip" .
|
|
|
|
popd
|