mirror of
https://github.com/topjohnwu/Magisk
synced 2025-08-31 12:15:15 +00:00
Update scripts
This commit is contained in:
@@ -17,7 +17,6 @@ $BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMO
|
||||
TMPDIR=/dev/tmp
|
||||
|
||||
INSTALLER=$TMPDIR/magisk
|
||||
BUSYBOX=$TMPDIR/busybox
|
||||
COMMONDIR=$INSTALLER/common
|
||||
CHROMEDIR=$INSTALLER/chromeos
|
||||
COREDIR=/magisk/.core
|
||||
@@ -49,13 +48,18 @@ if [ "$?" -eq "0" ]; then
|
||||
fi
|
||||
|
||||
rm -rf $TMPDIR 2>/dev/null
|
||||
mkdir -p $INSTALLER $BUSYBOX
|
||||
mkdir -p $INSTALLER
|
||||
unzip -o "$ZIP" -d $INSTALLER
|
||||
|
||||
##########################################################################################
|
||||
# Detection
|
||||
##########################################################################################
|
||||
|
||||
if [ ! -d "$COMMONDIR" ]; then
|
||||
echo "! Unable to extract zip file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load all fuctions
|
||||
. $COMMONDIR/util_functions.sh
|
||||
|
||||
@@ -63,10 +67,9 @@ ui_print "************************"
|
||||
ui_print "* MAGISK_VERSION_STUB"
|
||||
ui_print "************************"
|
||||
|
||||
[ -d "$COMMONDIR" ] || abort "! Unable to extract zip file!"
|
||||
|
||||
ui_print "- Mounting /system(ro), /cache, /data"
|
||||
ui_print "- Mounting /system(ro), /vendor(ro), /cache, /data"
|
||||
mount -o ro /system 2>/dev/null
|
||||
mount -o ro /vendor 2>/dev/null
|
||||
mount /cache 2>/dev/null
|
||||
mount /data 2>/dev/null
|
||||
|
||||
@@ -87,10 +90,10 @@ ABILONG=`grep_prop ro.product.cpu.abi`
|
||||
|
||||
ARCH=arm
|
||||
BBPATH=armeabi-v7a
|
||||
if [ "$ABI" = "x86" ]; then ARCH=x86; BBPATH=x86; fi;
|
||||
if [ "$ABI2" = "x86" ]; then ARCH=x86; BBPATH=x86; fi;
|
||||
if [ "$ABI" = "x86" ]; then ARCH=x86; fi;
|
||||
if [ "$ABI2" = "x86" ]; then ARCH=x86; fi;
|
||||
if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; fi;
|
||||
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; BBPATH=x86; fi;
|
||||
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; fi;
|
||||
|
||||
[ $API -lt 21 ] && abort "! Magisk is only for Lollipop 5.0+ (SDK 21+)"
|
||||
|
||||
@@ -108,22 +111,8 @@ find_boot_image
|
||||
|
||||
ui_print "- Constructing environment"
|
||||
|
||||
if ! $BOOTMODE; then
|
||||
# We are in custom recovery, don't trust anything in recovery, use those in /system
|
||||
# Extract busybox from Magisk Manager, it's pure static binary so there will be no issues
|
||||
unzip -o $COMMONDIR/magisk.apk lib/$BBPATH/libbusybox.so -d $BUSYBOX
|
||||
mv $BUSYBOX/lib/*/libbusybox.so $BUSYBOX/busybox
|
||||
rm -rf $BUSYBOX/lib
|
||||
chmod +x $BUSYBOX/busybox
|
||||
$BUSYBOX/busybox --install -s $BUSYBOX
|
||||
# Prefer bin in /system, fallback to bundled busybox if a tool doesn't exist
|
||||
export PATH=/system/bin:/system/xbin:$BUSYBOX
|
||||
# Clear out possible lib paths, let the binary find them itself
|
||||
export LD_LIBRARY_PATH=
|
||||
# Temporarily block out all custom recovery binaries/libs
|
||||
mv /sbin /sbin_tmp
|
||||
fi
|
||||
|
||||
$BOOTMODE || recovery_actions
|
||||
|
||||
is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
||||
|
||||
# Copy required files
|
||||
@@ -147,7 +136,7 @@ fi
|
||||
##########################################################################################
|
||||
|
||||
# Fix SuperSU.....
|
||||
$BOOTMODE && $BINDIR/magiskpolicy --live "allow fsck * * *"
|
||||
$BOOTMODE && $BINDIR/magisk magiskpolicy --live "allow fsck * * *"
|
||||
|
||||
if (is_mounted /data); then
|
||||
IMG=/data/magisk.img
|
||||
@@ -163,9 +152,11 @@ else
|
||||
$BINDIR/magisk --createimg $IMG 64M
|
||||
fi
|
||||
|
||||
mount_image $IMG /magisk
|
||||
if ! is_mounted /magisk; then
|
||||
ui_print "- Mounting $IMG to /magisk"
|
||||
MAGISKLOOP=`$BINDIR/magisk --mountimg $IMG /magisk`
|
||||
fi
|
||||
is_mounted /magisk || abort "! Magisk image mount failed..."
|
||||
MAGISKLOOP=$LOOPDEVICE
|
||||
|
||||
# Core folders
|
||||
mkdir -p $COREDIR/props $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
||||
@@ -222,12 +213,12 @@ rm -f new-boot.img
|
||||
cd /
|
||||
|
||||
if ! $BOOTMODE; then
|
||||
mv /sbin_tmp /sbin
|
||||
ui_print "- Unmounting partitions"
|
||||
umount /magisk
|
||||
losetup -d $MAGISKLOOP 2>/dev/null
|
||||
$BINDIR/magisk --umountimg /magisk $MAGISKLOOP
|
||||
rmdir /magisk
|
||||
mv /sbin_tmp /sbin
|
||||
umount -l /system
|
||||
umount -l /vendor 2>/dev/null
|
||||
fi
|
||||
|
||||
ui_print "- Done"
|
||||
|
Reference in New Issue
Block a user