Support patching AVD with release builds

This commit is contained in:
topjohnwu
2022-08-02 03:37:04 -07:00
parent b496923cbb
commit d17ed2b979
3 changed files with 23 additions and 18 deletions

View File

@@ -3,8 +3,7 @@
# AVD Magisk Setup
#####################################################################
#
# Support emulator ABI: ALL
# Support API level: 23 - 31 (21 and 22 images do not have SELinux)
# Support API level: 21 - 33
#
# With an emulator booted and accessible via ADB, usage:
# ./build.py emulator
@@ -46,15 +45,15 @@ if [ -z "$FIRST_STAGE" ]; then
fi
fi
pm install -r $(pwd)/app-debug.apk
pm install -r $(pwd)/magisk.apk
# Extract files from APK
unzip -oj app-debug.apk 'assets/util_functions.sh'
unzip -oj magisk.apk 'assets/util_functions.sh'
. ./util_functions.sh
api_level_arch_detect
unzip -oj app-debug.apk "lib/$ABI/*" "lib/$ABI32/libmagisk32.so" -x "lib/$ABI/libbusybox.so"
unzip -oj magisk.apk "lib/$ABI/*" "lib/$ABI32/libmagisk32.so" -x "lib/$ABI/libbusybox.so"
for file in lib*.so; do
chmod 755 $file
mv "$file" "${file:3:${#file}-6}"
@@ -120,8 +119,7 @@ fi
# Magisk stuff
mkdir -p $MAGISKBIN 2>/dev/null
unzip -oj app-debug.apk 'assets/*' -x 'assets/chromeos/*' \
-x 'assets/bootctl' -x 'assets/main.jar' -d $MAGISKBIN
unzip -oj magisk.apk 'assets/*.sh' -d $MAGISKBIN
mkdir $NVBASE/modules 2>/dev/null
mkdir $POSTFSDATAD 2>/dev/null
mkdir $SERVICED 2>/dev/null
@@ -135,7 +133,7 @@ cp -af ./magiskboot $MAGISKBIN/magiskboot
cp -af ./magiskinit $MAGISKBIN/magiskinit
cp -af ./busybox $MAGISKBIN/busybox
if [ "$IS64BIT" = "true" ]; then
if $IS64BIT; then
ln -s ./magisk64 $MAGISKTMP/magisk
else
ln -s ./magisk32 $MAGISKTMP/magisk