Drop image based Magisk support

This commit is contained in:
topjohnwu 2019-12-15 21:01:12 -05:00
parent 404104208f
commit 06c42d05c3
2 changed files with 9 additions and 48 deletions

View File

@ -14,17 +14,12 @@ mkdir -p $TMPDIR
ui_print() { echo "$1"; } ui_print() { echo "$1"; }
require_new_magisk() { require_new_magisk() {
ui_print "***********************************" ui_print "*******************************"
ui_print " Please install the latest Magisk! " ui_print " Please install Magisk v19.0+! "
ui_print "***********************************" ui_print "*******************************"
exit 1 exit 1
} }
imageless_magisk() {
[ $MAGISK_VER_CODE -gt 18100 ]
return $?
}
########################################################################################## ##########################################################################################
# Environment # Environment
########################################################################################## ##########################################################################################
@ -38,6 +33,7 @@ mount /data 2>/dev/null
if [ -f /data/adb/magisk/util_functions.sh ]; then if [ -f /data/adb/magisk/util_functions.sh ]; then
. /data/adb/magisk/util_functions.sh . /data/adb/magisk/util_functions.sh
NVBASE=/data/adb NVBASE=/data/adb
[ $MAGISK_VER_CODE -gt 18100 ] || require_new_magisk
else else
require_new_magisk require_new_magisk
fi fi
@ -65,16 +61,8 @@ unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >
# Load install script # Load install script
. $TMPDIR/install.sh . $TMPDIR/install.sh
if imageless_magisk; then $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules MODULEROOT=$NVBASE/$MODDIRNAME
MODULEROOT=$NVBASE/$MODDIRNAME
else
$BOOTMODE && IMGNAME=magisk_merge.img || IMGNAME=magisk.img
IMG=$NVBASE/$IMGNAME
request_zip_size_check "$ZIPFILE"
mount_magisk_img
MODULEROOT=$MOUNTPATH
fi
MODID=`grep_prop id $TMPDIR/module.prop` MODID=`grep_prop id $TMPDIR/module.prop`
MODPATH=$MODULEROOT/$MODID MODPATH=$MODULEROOT/$MODID
@ -102,11 +90,7 @@ rm -f $MODPATH/system/placeholder 2>/dev/null
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh [ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
# Auto Mount # Auto Mount
if imageless_magisk; then $SKIPMOUNT && touch $MODPATH/skip_mount
$SKIPMOUNT && touch $MODPATH/skip_mount
else
$SKIPMOUNT || touch $MODPATH/auto_mount
fi
# prop files # prop files
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop $PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
@ -115,13 +99,8 @@ $PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
cp -af $TMPDIR/module.prop $MODPATH/module.prop cp -af $TMPDIR/module.prop $MODPATH/module.prop
if $BOOTMODE; then if $BOOTMODE; then
# Update info for Magisk Manager # Update info for Magisk Manager
if imageless_magisk; then
mktouch $NVBASE/modules/$MODID/update mktouch $NVBASE/modules/$MODID/update
cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop
else
mktouch /sbin/.magisk/img/$MODID/update
cp -af $TMPDIR/module.prop /sbin/.magisk/img/$MODID/module.prop
fi
fi fi
# post-fs-data mode scripts # post-fs-data mode scripts
@ -143,7 +122,6 @@ set_permissions
########################################################################################## ##########################################################################################
cd / cd /
imageless_magisk || unmount_magisk_img
$BOOTMODE || recovery_cleanup $BOOTMODE || recovery_cleanup
rm -rf $TMPDIR $MOUNTPATH rm -rf $TMPDIR $MOUNTPATH

View File

@ -446,23 +446,6 @@ request_zip_size_check() {
reqSizeM=`unzip -l "$1" | tail -n 1 | awk '{ print int(($1 - 1) / 1048576 + 1) }'` reqSizeM=`unzip -l "$1" | tail -n 1 | awk '{ print int(($1 - 1) / 1048576 + 1) }'`
} }
##################################
# Backwards Compatibile Functions
##################################
get_outfd() { setup_flashable; }
mount_magisk_img() {
$BOOTMODE && MODULE_BASE=modules_update || MODULE_BASE=modules
MODULEPATH=$NVBASE/$MODULE_BASE
mkdir -p $MODULEPATH 2>/dev/null
ln -s $MODULEPATH $MOUNTPATH
}
unmount_magisk_img() {
rm -f $MOUNTPATH 2>/dev/null
}
boot_actions() { return; } boot_actions() { return; }
######## ########