[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" . "$TMPDIR/util_functions.sh"
check_android_version check_android_version
check_magisk_version check_magisk_version
check_incompatible_module
# Extract riru.sh # Extract riru.sh
extract "$ZIPFILE" 'riru.sh' "$TMPDIR" extract "$ZIPFILE" 'riru.sh' "$TMPDIR"
@ -110,10 +111,6 @@ if [ -f /data/adb/lspd/misc_path ]; then
# read current MISC_PATH # read current MISC_PATH
MISC_PATH=$(cat /data/adb/lspd/misc_path) MISC_PATH=$(cat /data/adb/lspd/misc_path)
ui_print " - Use previous path $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 else
# generate random MISC_PATH # generate random MISC_PATH
MISC_RAND=$(tr -cd 'A-Za-z0-9' </dev/urandom | head -c16) MISC_RAND=$(tr -cd 'A-Za-z0-9' </dev/urandom | head -c16)

View File

@ -42,3 +42,16 @@ check_android_version() {
require_new_android "$API" require_new_android "$API"
fi 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
}