Update scripts

This commit is contained in:
topjohnwu 2022-12-26 15:59:56 -08:00 committed by John Wu
parent 7ce4bd3330
commit 76fbf4634a
3 changed files with 14 additions and 11 deletions

View File

@ -48,7 +48,7 @@ fi
pm install -r $(pwd)/magisk.apk pm install -r $(pwd)/magisk.apk
# Extract files from 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 . ./util_functions.sh
api_level_arch_detect api_level_arch_detect
@ -120,12 +120,11 @@ fi
# Magisk stuff # Magisk stuff
mkdir -p $MAGISKBIN 2>/dev/null mkdir -p $MAGISKBIN 2>/dev/null
unzip -oj magisk.apk 'assets/*.sh' -d $MAGISKBIN unzip -oj magisk.apk 'assets/*.sh' -d $MAGISKBIN
unzip -oj magisk.apk 'assets/stub.apk' -d $MAGISKTMP
mkdir $NVBASE/modules 2>/dev/null mkdir $NVBASE/modules 2>/dev/null
mkdir $POSTFSDATAD 2>/dev/null mkdir $POSTFSDATAD 2>/dev/null
mkdir $SERVICED 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 chmod 755 ./$file
cp -af ./$file $MAGISKTMP/$file cp -af ./$file $MAGISKTMP/$file
cp -af ./$file $MAGISKBIN/$file cp -af ./$file $MAGISKBIN/$file

View File

@ -6,7 +6,7 @@
# Usage: boot_patch.sh <bootimage> # Usage: boot_patch.sh <bootimage>
# #
# The following flags can be set in environment variables: # 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: # 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. # boot_patch.sh script A script to patch boot image for Magisk.
# (this file) The script will use files in its same # (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 # util_functions.sh script A script which hosts all functions required
# for this script to work properly # for this script to work properly.
# magiskinit binary The binary to replace /init # magiskinit binary The binary to replace /init.
# magisk(32/64) binary The magisk binaries # magisk(32/64) binary The magisk binaries.
# magiskboot binary A tool to manipulate boot images # 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 # chromeos folder This folder includes the utility and keys to sign
# (optional) chromeos boot images. Only used for Pixel C. # (optional) chromeos boot images. Only used for Pixel C.
# #

View File

@ -57,8 +57,6 @@ cd $BINDIR
for file in lib*.so; do mv "$file" "${file:3:${#file}-6}"; done for file in lib*.so; do mv "$file" "${file:3:${#file}-6}"; done
cd / cd /
cp -af $INSTALLER/lib/$ABI32/libmagisk32.so $BINDIR/magisk32 2>/dev/null 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 # Check if system root is installed and remove
$BOOTMODE || remove_system_su $BOOTMODE || remove_system_su
@ -73,6 +71,11 @@ ui_print "- Constructing environment"
rm -rf $MAGISKBIN/* 2>/dev/null rm -rf $MAGISKBIN/* 2>/dev/null
mkdir -p $MAGISKBIN 2>/dev/null mkdir -p $MAGISKBIN 2>/dev/null
cp -af $BINDIR/. $COMMONDIR/. $BBBIN $MAGISKBIN 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 chmod -R 755 $MAGISKBIN
# addon.d # addon.d