diff --git a/scripts/avd_magisk.sh b/scripts/avd_magisk.sh index 664d6eb03..9ea7f8631 100755 --- a/scripts/avd_magisk.sh +++ b/scripts/avd_magisk.sh @@ -48,7 +48,7 @@ fi pm install -r $(pwd)/magisk.apk # Extract files from APK -unzip -oj magisk.apk 'assets/util_functions.sh' +unzip -oj magisk.apk 'assets/util_functions.sh' 'assets/stub.apk' . ./util_functions.sh api_level_arch_detect @@ -120,12 +120,11 @@ fi # Magisk stuff mkdir -p $MAGISKBIN 2>/dev/null unzip -oj magisk.apk 'assets/*.sh' -d $MAGISKBIN -unzip -oj magisk.apk 'assets/stub.apk' -d $MAGISKTMP mkdir $NVBASE/modules 2>/dev/null mkdir $POSTFSDATAD 2>/dev/null mkdir $SERVICED 2>/dev/null -for file in magisk32 magisk64 magiskpolicy; do +for file in magisk32 magisk64 magiskpolicy stub.apk; do chmod 755 ./$file cp -af ./$file $MAGISKTMP/$file cp -af ./$file $MAGISKBIN/$file diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index e3519ba6e..068097c38 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -6,7 +6,7 @@ # Usage: boot_patch.sh # # The following flags can be set in environment variables: -# KEEPVERITY, KEEPFORCEENCRYPT, RECOVERYMODE +# KEEPVERITY, KEEPFORCEENCRYPT, PATCHVBMETAFLAG, RECOVERYMODE # # This script should be placed in a directory with the following files: # @@ -14,12 +14,13 @@ # # boot_patch.sh script A script to patch boot image for Magisk. # (this file) The script will use files in its same -# directory to complete the patching process +# directory to complete the patching process. # util_functions.sh script A script which hosts all functions required -# for this script to work properly -# magiskinit binary The binary to replace /init -# magisk(32/64) binary The magisk binaries -# magiskboot binary A tool to manipulate boot images +# for this script to work properly. +# magiskinit binary The binary to replace /init. +# magisk(32/64) binary The magisk binaries. +# magiskboot binary A tool to manipulate boot images. +# stub.apk binary The stub Magisk app to embed into ramdisk. # chromeos folder This folder includes the utility and keys to sign # (optional) chromeos boot images. Only used for Pixel C. # diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index b6e8275ef..7e449cc97 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -57,8 +57,6 @@ cd $BINDIR for file in lib*.so; do mv "$file" "${file:3:${#file}-6}"; done cd / cp -af $INSTALLER/lib/$ABI32/libmagisk32.so $BINDIR/magisk32 2>/dev/null -cp -af $CHROMEDIR/. $BINDIR/chromeos -chmod -R 755 $BINDIR # Check if system root is installed and remove $BOOTMODE || remove_system_su @@ -73,6 +71,11 @@ ui_print "- Constructing environment" rm -rf $MAGISKBIN/* 2>/dev/null mkdir -p $MAGISKBIN 2>/dev/null cp -af $BINDIR/. $COMMONDIR/. $BBBIN $MAGISKBIN + +# Remove files only used by the Magisk app +rm -f $MAGISKBIN/bootctl $MAGISKBIN/main.jar \ + $MAGISKBIN/module_installer.sh $MAGISKBIN/uninstaller.sh + chmod -R 755 $MAGISKBIN # addon.d