mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
drop support for Magisk older than 19.0
This commit is contained in:
parent
58996ad183
commit
a8925344aa
@ -2,6 +2,11 @@
|
||||
|
||||
## 20.9 in-dev
|
||||
|
||||
### Notes
|
||||
|
||||
* This release drops support for Magisk older than version 19.0!
|
||||
* except the Uninstaller
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* logscleaner init.d Script
|
||||
|
@ -210,10 +210,7 @@ error () {
|
||||
ui_print "${@}"
|
||||
ui_print " !!"
|
||||
|
||||
if [ "${MODE}" = "MAGISK" ]; then
|
||||
rm -rf "${MODPATH}"
|
||||
unmount_magisk_img
|
||||
fi
|
||||
[ "${MODE}" = "MAGISK" ] && rm -rf "${MODPATH}"
|
||||
|
||||
recovery_cleanup
|
||||
|
||||
@ -274,8 +271,10 @@ migrate_magisk_custom () {
|
||||
chmod 0644 /data/adb
|
||||
fi
|
||||
|
||||
mv ${1} /data/adb/magisk
|
||||
cp /data/adb/magisk/magisk.apk /data/adb/magisk.apk
|
||||
if [ ! -f /data/adb/magisk.db ]; then
|
||||
mv ${1} /data/adb/magisk
|
||||
cp /data/adb/magisk/magisk.apk /data/adb/magisk.apk
|
||||
fi
|
||||
}
|
||||
|
||||
detect_mode () {
|
||||
@ -569,7 +568,7 @@ magisk_install_setup () {
|
||||
|
||||
recovery_actions
|
||||
else
|
||||
magisk_install_setup_old
|
||||
error "Magisk version 19.0 or newer is required"
|
||||
fi
|
||||
|
||||
case ${MODID} in
|
||||
@ -603,45 +602,6 @@ magisk_install_setup () {
|
||||
[ -d ${MODPATH} ] && NANODROID_UPGRADE=1
|
||||
}
|
||||
|
||||
magisk_install_setup_old () {
|
||||
MOUNTPATH=${TMPDIR}/magisk_img
|
||||
MODPATH=${MOUNTPATH}/${MODID}
|
||||
REALPATH=/sbin/.magisk/img/${MODID}
|
||||
|
||||
mkdir -p ${MOUNTPATH}
|
||||
|
||||
IMG=${NVBASE}/magisk.img
|
||||
e2fsck -yf ${IMG}
|
||||
|
||||
recovery_actions
|
||||
|
||||
request_size_check "${INSTALLER}"
|
||||
reqSizeM=$((reqSizeM * 2))
|
||||
|
||||
if [ -f ${IMG} ]; then
|
||||
MAGISKLOOP=`${MAGISKBIN}/magisk imgtool mount ${IMG} ${MOUNTPATH}`
|
||||
is_mounted ${MOUNTPATH} || error "failed to mount ${IMG}"
|
||||
|
||||
check_filesystem ${IMG} ${MOUNTPATH}
|
||||
|
||||
if [ ${reqSizeM} -gt ${curFreeM} ]; then
|
||||
${MAGISKBIN}/magisk imgtool umount ${MOUNTPATH} ${MAGISKLOOP}
|
||||
newSizeM=$(((curSizeM + reqSizeM - curFreeM) / 32 * 32 + 64))
|
||||
resize2fs -f ${IMG} ${newSizeM}M
|
||||
e2fsck -yf ${IMG}
|
||||
MAGISKLOOP=`${MAGISKBIN}/magisk imgtool mount ${IMG} ${MOUNTPATH}`
|
||||
is_mounted ${MOUNTPATH} || error "failed to mount ${IMG}"
|
||||
fi
|
||||
else
|
||||
newSizeM=$((reqSizeM / 32 * 32 + 64))
|
||||
${MAGISKBIN}/magisk imgtool create ${IMG} ${newSizeM}
|
||||
e2fsck -yf ${IMG}
|
||||
|
||||
MAGISKLOOP=`${MAGISKBIN}/magisk imgtool mount ${IMG} ${MOUNTPATH}`
|
||||
is_mounted ${MOUNTPATH} || error "failed to mount ${IMG}"
|
||||
fi
|
||||
}
|
||||
|
||||
magisk_install_preinst () {
|
||||
if [ -f ${MODPATH}/system.prop ]; then
|
||||
ui_print " << backing up module's system.prop"
|
||||
@ -695,7 +655,6 @@ magisk_install_postinst () {
|
||||
|
||||
magisk_install_finish () {
|
||||
# Magisk Module files
|
||||
[ ${MAGISK_VER_CODE} -le 18100 ] && mktouch ${MODPATH}/auto_mount
|
||||
cp -af ${INSTALLER}/module.prop ${MODPATH}/module.prop
|
||||
|
||||
if [ -f ${INSTALLER}/service.sh ]; then
|
||||
@ -714,11 +673,6 @@ magisk_install_finish () {
|
||||
${NANODROID_BINDIR}/nanodroid-font -s "${CUSTOM_FONT}"
|
||||
fi
|
||||
|
||||
if [ ${MAGISK_VER_CODE} -le 18100 ]; then
|
||||
unmount_magisk_img
|
||||
e2fsck -yf ${IMG}
|
||||
fi
|
||||
|
||||
recovery_cleanup
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,6 @@ setup_environment () {
|
||||
elif [ -f /data/magisk/util_functions.sh ]; then
|
||||
NVBASE=/data
|
||||
fi
|
||||
|
||||
MAGISK_IMG=${NVBASE}/magisk.img
|
||||
MAGISK_PATH=/dev/tmp/magisk_img
|
||||
}
|
||||
|
||||
ui_print() {
|
||||
@ -40,27 +37,6 @@ is_mounted () {
|
||||
return $?
|
||||
}
|
||||
|
||||
mount_image() {
|
||||
if [ ! -d "$2" ]; then
|
||||
mount -o rw,remount rootfs /
|
||||
mkdir -p "$2" 2>/dev/null
|
||||
[ ! -d "$2" ] && return 1
|
||||
fi
|
||||
|
||||
if ! is_mounted "$2"; then
|
||||
LOOPDEVICE=
|
||||
for LOOP in 0 1 2 3 4 5 6 7; do
|
||||
if ! is_mounted "$2"; then
|
||||
LOOPDEVICE=/dev/block/loop$LOOP
|
||||
[ -e $LOOPDEVICE ] || mknod $LOOPDEVICE b 7 $LOOP 2>/dev/null
|
||||
losetup $LOOPDEVICE "$1" && mount -t ext4 -o loop $LOOPDEVICE "$2"
|
||||
if is_mounted "$2"; then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# taken from Magisk, with minor modifications for NanoDroid
|
||||
mount_partitions () {
|
||||
@ -111,7 +87,6 @@ error () {
|
||||
ui_print " !! ${@}"
|
||||
ui_print " "
|
||||
|
||||
magisk_cleanup
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -331,63 +306,6 @@ search_fake_package_signature () {
|
||||
${HAS_FAKESIGN} && return 0 || return 1
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
# Magisk Functions
|
||||
##########################################################################################
|
||||
|
||||
grow_magisk_img () {
|
||||
request_size_check /tmp/services.jar
|
||||
image_size_check ${MAGISK_IMG}
|
||||
if [ "$reqSizeM" -gt "$curFreeM" ]; then
|
||||
SIZE=$(((reqSizeM + curUsedM) / 32 * 32 + 64))
|
||||
resize2fs -f ${MAGISK_IMG} ${SIZE}M
|
||||
e2fsck -yf ${MAGISK_IMG}
|
||||
fi
|
||||
}
|
||||
|
||||
shrink_magisk_img () {
|
||||
image_size_check ${MAGISK_IMG}
|
||||
NEWDATASIZE=$((curUsedM / 32 * 32 + 32))
|
||||
if [ "$curSizeM" -gt "$NEWDATASIZE" ]; then
|
||||
resize2fs -f ${MAGISK_IMG} ${NEWDATASIZE}M
|
||||
e2fsck -yf ${MAGISK_IMG}
|
||||
fi
|
||||
}
|
||||
|
||||
request_size_check() {
|
||||
reqSizeM=`unzip -l "$1" 2>/dev/null | tail -n 1 | awk '{ print $1 }'`
|
||||
reqSizeM=$((reqSizeM / 1048576 + 1))
|
||||
}
|
||||
|
||||
image_size_check() {
|
||||
e2fsck -yf $1
|
||||
curBlocks=`e2fsck -n $1 2>/dev/null | grep $1 | cut -d, -f3 | cut -d\ -f2`;
|
||||
curUsedM=`echo "$curBlocks" | cut -d/ -f1`
|
||||
curSizeM=`echo "$curBlocks" | cut -d/ -f1`
|
||||
curFreeM=$(((curSizeM - curUsedM) * 4 / 1024))
|
||||
curUsedM=$((curUsedM * 4 / 1024 + 1))
|
||||
curSizeM=$((curSizeM * 4 / 1024))
|
||||
}
|
||||
|
||||
magisk_setup () {
|
||||
if [ -f ${MAGISK_IMG} ]; then
|
||||
grow_magisk_img || \
|
||||
error "failed to grow magisk.img"
|
||||
mount_image ${MAGISK_IMG} ${MAGISK_PATH} || \
|
||||
error "failed to mount ${MAGISK_PATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
magisk_cleanup () {
|
||||
if (is_mounted ${MAGISK_PATH}); then
|
||||
umount ${MAGISK_PATH}
|
||||
losetup -d $LOOPDEVICE
|
||||
rmdir ${MAGISK_PATH}
|
||||
shrink_magisk_img || \
|
||||
error "failed to shrink magisk.img"
|
||||
fi
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
# Patcher Functions
|
||||
##########################################################################################
|
||||
@ -549,9 +467,7 @@ backup_services_jar () {
|
||||
|
||||
install_services () {
|
||||
ui_print " "
|
||||
for destination in /data/adb/modules/NanoDroid /data/adb/modules/NanoDroid_microG \
|
||||
/dev/tmp/magisk_img/NanoDroid /dev/tmp/magisk_img/NanoDroid_microG \
|
||||
/sbin/.magisk/img/NanoDroid /sbin/.magisk/img/NanoDroid_microG /; do
|
||||
for destination in /data/adb/modules/NanoDroid /data/adb/modules/NanoDroid_microG /; do
|
||||
if [ -d ${destination} ]; then
|
||||
install_path="${destination}"
|
||||
break
|
||||
|
@ -52,17 +52,10 @@ fi
|
||||
|
||||
detect_odex
|
||||
|
||||
[ -f ${MAGISK_IMG} ] && magisk_setup
|
||||
|
||||
patch_services
|
||||
install_services
|
||||
install_addond
|
||||
|
||||
ui_print " "
|
||||
ui_print " >> clean up"
|
||||
|
||||
magisk_cleanup
|
||||
|
||||
if ! ${BOOTMODE} ; then
|
||||
umount -l /system_root 2>/dev/null
|
||||
umount -l /system 2>/dev/null
|
||||
|
@ -58,17 +58,9 @@ NanoDroidPatcher () {
|
||||
fi
|
||||
|
||||
detect_odex
|
||||
|
||||
[ -f ${MAGISK_IMG} ] && magisk_setup
|
||||
|
||||
patch_services
|
||||
install_services
|
||||
|
||||
ui_print " "
|
||||
ui_print " >> clean up"
|
||||
|
||||
magisk_cleanup
|
||||
|
||||
ui_print " "
|
||||
ui_print " > Done!"
|
||||
ui_print " "
|
||||
|
Loading…
Reference in New Issue
Block a user