mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Update scripts
This commit is contained in:
parent
3c7e865555
commit
529aa754f5
@ -17,6 +17,7 @@ ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
|
|||||||
TMPDIR=/dev/tmp
|
TMPDIR=/dev/tmp
|
||||||
|
|
||||||
INSTALLER=$TMPDIR/magisk
|
INSTALLER=$TMPDIR/magisk
|
||||||
|
COMMONDIR=$INSTALLER/common
|
||||||
BOOTTMP=$TMPDIR/boottmp
|
BOOTTMP=$TMPDIR/boottmp
|
||||||
COREDIR=/magisk/.core
|
COREDIR=/magisk/.core
|
||||||
CHROMEDIR=$INSTALLER/chromeos
|
CHROMEDIR=$INSTALLER/chromeos
|
||||||
@ -178,7 +179,7 @@ ui_print "*****************************"
|
|||||||
ui_print "MAGISK_VERSION_STUB"
|
ui_print "MAGISK_VERSION_STUB"
|
||||||
ui_print "*****************************"
|
ui_print "*****************************"
|
||||||
|
|
||||||
if [ ! -d "$INSTALLER/common" ]; then
|
if [ ! -d "$COMMONDIR" ]; then
|
||||||
ui_print "! Failed: Unable to extract zip file!"
|
ui_print "! Failed: Unable to extract zip file!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -248,8 +249,8 @@ is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
|||||||
rm -rf $MAGISKBIN 2>/dev/null
|
rm -rf $MAGISKBIN 2>/dev/null
|
||||||
mkdir -p $MAGISKBIN
|
mkdir -p $MAGISKBIN
|
||||||
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop $BINDIR/magiskboot \
|
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop $BINDIR/magiskboot \
|
||||||
$INSTALLER/common/ramdisk_patch.sh $INSTALLER/common/init.magisk.rc \
|
$COMMONDIR/ramdisk_patch.sh $COMMONDIR/init.magisk.rc \
|
||||||
$INSTALLER/common/magic_mask.sh $MAGISKBIN
|
$COMMONDIR/magic_mask.sh $COMMONDIR/magisk.apk $MAGISKBIN
|
||||||
chmod -R 755 $MAGISKBIN
|
chmod -R 755 $MAGISKBIN
|
||||||
chcon -h u:object_r:system_file:s0 $MAGISKBIN $MAGISKBIN/*
|
chcon -h u:object_r:system_file:s0 $MAGISKBIN $MAGISKBIN/*
|
||||||
|
|
||||||
@ -332,7 +333,7 @@ case $? in
|
|||||||
SUPERSU=true
|
SUPERSU=true
|
||||||
ui_print "- SuperSU patched boot detected!"
|
ui_print "- SuperSU patched boot detected!"
|
||||||
ui_print "- Adding auto patch script for SuperSU"
|
ui_print "- Adding auto patch script for SuperSU"
|
||||||
cp -af $INSTALLER/common/ramdisk_patch.sh /data/custom_ramdisk_patch.sh
|
cp -af $COMMONDIR/ramdisk_patch.sh /data/custom_ramdisk_patch.sh
|
||||||
is_mounted /data && SUIMG=/data/su.img || SUIMG=/cache/su.img
|
is_mounted /data && SUIMG=/data/su.img || SUIMG=/cache/su.img
|
||||||
mount_image $SUIMG /su
|
mount_image $SUIMG /su
|
||||||
SUPERSULOOP=$LOOPDEVICE
|
SUPERSULOOP=$LOOPDEVICE
|
||||||
@ -373,7 +374,7 @@ esac
|
|||||||
|
|
||||||
# All ramdisk patch commands are stored in a separate script
|
# All ramdisk patch commands are stored in a separate script
|
||||||
ui_print "- Patching ramdisk"
|
ui_print "- Patching ramdisk"
|
||||||
. $INSTALLER/common/ramdisk_patch.sh $BOOTTMP/ramdisk.cpio
|
. $COMMONDIR/ramdisk_patch.sh $BOOTTMP/ramdisk.cpio
|
||||||
|
|
||||||
cd $BOOTTMP
|
cd $BOOTTMP
|
||||||
# Create ramdisk backups
|
# Create ramdisk backups
|
||||||
@ -403,7 +404,7 @@ if [ -f $IMG ]; then
|
|||||||
ui_print "- $IMG detected!"
|
ui_print "- $IMG detected!"
|
||||||
else
|
else
|
||||||
ui_print "- Creating $IMG"
|
ui_print "- Creating $IMG"
|
||||||
make_ext4fs -l 64M -a /magisk -S $INSTALLER/common/file_contexts_image $IMG
|
make_ext4fs -l 64M -a /magisk -S $COMMONDIR/file_contexts_image $IMG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mount_image $IMG /magisk
|
mount_image $IMG /magisk
|
||||||
@ -415,14 +416,14 @@ MAGISKLOOP=$LOOPDEVICE
|
|||||||
|
|
||||||
# Core folders and scripts
|
# Core folders and scripts
|
||||||
mkdir -p $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
mkdir -p $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
||||||
cp -af $INSTALLER/common/magiskhide/. $BINDIR/magiskhide $COREDIR/magiskhide
|
cp -af $COMMONDIR/magiskhide/. $BINDIR/magiskhide $COREDIR/magiskhide
|
||||||
chmod -R 755 $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
chmod -R 755 $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||||
chown -R 0.0 $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
chown -R 0.0 $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||||
|
|
||||||
if ! $SUPERSU; then
|
if ! $SUPERSU; then
|
||||||
ui_print "- Installing MagiskSU"
|
ui_print "- Installing MagiskSU"
|
||||||
mkdir -p $COREDIR/su 2>/dev/null
|
mkdir -p $COREDIR/su 2>/dev/null
|
||||||
cp -af $BINDIR/su $INSTALLER/common/magisksu.sh $COREDIR/su
|
cp -af $BINDIR/su $COMMONDIR/magisksu.sh $COREDIR/su
|
||||||
chmod -R 755 $COREDIR/su
|
chmod -R 755 $COREDIR/su
|
||||||
chown -R 0.0 $COREDIR/su
|
chown -R 0.0 $COREDIR/su
|
||||||
fi
|
fi
|
||||||
|
@ -293,10 +293,7 @@ case $1 in
|
|||||||
log_print "** Magisk post-fs-data mode running..."
|
log_print "** Magisk post-fs-data mode running..."
|
||||||
|
|
||||||
# Cache support
|
# Cache support
|
||||||
mv /cache/stock_boot.img /data/stock_boot.img 2>/dev/null
|
mv /cache/stock_boot* /data 2>/dev/null
|
||||||
mv /cache/magisk.apk /data/magisk.apk 2>/dev/null
|
|
||||||
mv /cache/custom_ramdisk_patch.sh /data/custom_ramdisk_patch.sh 2>/dev/null
|
|
||||||
|
|
||||||
if [ -d /cache/data_bin ]; then
|
if [ -d /cache/data_bin ]; then
|
||||||
rm -rf $BINPATH
|
rm -rf $BINPATH
|
||||||
mv /cache/data_bin $BINPATH
|
mv /cache/data_bin $BINPATH
|
||||||
@ -311,7 +308,7 @@ case $1 in
|
|||||||
if [ -f $UNINSTALLER ]; then
|
if [ -f $UNINSTALLER ]; then
|
||||||
touch /dev/.magisk.unblock
|
touch /dev/.magisk.unblock
|
||||||
chcon u:object_r:device:s0 /dev/.magisk.unblock
|
chcon u:object_r:device:s0 /dev/.magisk.unblock
|
||||||
BOOTMODE=true sh $UNINSTALLER
|
sh $UNINSTALLER
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -384,9 +381,6 @@ case $1 in
|
|||||||
|
|
||||||
log_print "* Preparing modules"
|
log_print "* Preparing modules"
|
||||||
|
|
||||||
mkdir -p $DUMMDIR
|
|
||||||
mkdir -p $MIRRDIR/system
|
|
||||||
|
|
||||||
# Remove crap folder
|
# Remove crap folder
|
||||||
rm -rf $MOUNTPOINT/lost+found
|
rm -rf $MOUNTPOINT/lost+found
|
||||||
|
|
||||||
@ -479,10 +473,10 @@ case $1 in
|
|||||||
bind_mount $COREDIR/hosts /system/etc/hosts
|
bind_mount $COREDIR/hosts /system/etc/hosts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /data/magisk.apk ]; then
|
if [ -f /data/magisk/magisk.apk ]; then
|
||||||
if [ -z `ls /data/app | grep com.topjohnwu.magisk` ]; then
|
if [ -z `ls /data/app | grep com.topjohnwu.magisk` ]; then
|
||||||
mkdir /data/app/com.topjohnwu.magisk-1
|
mkdir /data/app/com.topjohnwu.magisk-1
|
||||||
cp /data/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
|
cp /data/magisk/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
|
||||||
chown 1000.1000 /data/app/com.topjohnwu.magisk-1
|
chown 1000.1000 /data/app/com.topjohnwu.magisk-1
|
||||||
chown 1000.1000 /data/app/com.topjohnwu.magisk-1/base.apk
|
chown 1000.1000 /data/app/com.topjohnwu.magisk-1/base.apk
|
||||||
chmod 755 /data/app/com.topjohnwu.magisk-1
|
chmod 755 /data/app/com.topjohnwu.magisk-1
|
||||||
@ -490,7 +484,7 @@ case $1 in
|
|||||||
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1
|
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1
|
||||||
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1/base.apk
|
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1/base.apk
|
||||||
fi
|
fi
|
||||||
rm -f /data/magisk.apk 2>/dev/null
|
rm -f /data/magisk/magisk.apk 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for MOD in $MOUNTPOINT/* ; do
|
for MOD in $MOUNTPOINT/* ; do
|
||||||
|
Loading…
Reference in New Issue
Block a user