[core] Abort installation on devices with incompatible frameworks (#557)

* [core] Abort installation on devices with incompatible frameworks

* Update util_functions.sh

* Update util_functions.sh

Co-authored-by: vvb2060 <vvb2060@gmail.com>
This commit is contained in:
Wang Han 2021-05-10 09:41:33 +08:00 committed by GitHub
parent 7a35906cb6
commit 95f0305b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View File

@ -43,6 +43,7 @@ extract "$ZIPFILE" 'util_functions.sh' "$TMPDIR"
. "$TMPDIR/util_functions.sh"
check_android_version
check_magisk_version
check_incompatible_module
# Extract riru.sh
extract "$ZIPFILE" 'riru.sh' "$TMPDIR"
@ -110,10 +111,6 @@ if [ -f /data/adb/lspd/misc_path ]; then
# read current MISC_PATH
MISC_PATH=$(cat /data/adb/lspd/misc_path)
ui_print " - Use previous path $MISC_PATH"
elif [ -f /data/adb/edxp/misc_path ]; then
ui_print " - WARNING: This installation will disable EdXposed because of incompatibility"
touch "$(magisk --path)/.magisk/modules/riru_edxposed/disable"
touch "$(magisk --path)/.magisk/modules/riru_edxposed_sandhook/disable"
else
# generate random MISC_PATH
MISC_RAND=$(tr -cd 'A-Za-z0-9' </dev/urandom | head -c16)

View File

@ -21,9 +21,9 @@
check_magisk_version() {
ui_print "- Magisk version: $MAGISK_VER_CODE"
if [ "$MAGISK_VER_CODE" -lt 21000 ]; then
ui_print "*********************************************************"
ui_print "! Please install Magisk v21+"
abort "*********************************************************"
ui_print "*********************************************************"
ui_print "! Please install Magisk v21+"
abort "*********************************************************"
fi
}
@ -32,7 +32,7 @@ require_new_android() {
ui_print "! Unsupported Android version ${1} (below Oreo MR1)"
ui_print "! Learn more from our GitHub Wiki"
[ "$BOOTMODE" == "true" ] && am start -a android.intent.action.VIEW -d https://github.com/LSPosed/LSPosed/wiki/Available-Android-versions
abort "*********************************************************"
abort "*********************************************************"
}
check_android_version() {
@ -42,3 +42,16 @@ check_android_version() {
require_new_android "$API"
fi
}
check_incompatible_module() {
MODULEDIR="$(magisk --path)/.magisk/modules"
FINDMODULE=false
for id in "riru_dreamland" "riru_edxposed" "riru_edxposed_sandhook" "taichi"; do
[ -d $MODULEDIR/$id ] && [ ! -f $MODULEDIR/$id/disable ] && FINDMODULE=true
done
if $FINDMODULE; then
ui_print "*********************************************************"
ui_print "! Please disable or uninstall incompatible frameworks (Dreamland, EdXposed or Taichi)"
abort "*********************************************************"
fi
}