1
0
mirror of https://github.com/LSPosed/LSPosed.git synced 2024-11-23 17:56:15 +00:00
LSPosed/magisk-loader/magisk_module/util_functions.sh
Howard Wu 760f0bb0eb
All flavors require Magisk 24.0+ (#2368)
Magisk 23 is missing some SELinux policies

This fixes a permissions issue with the Dex2Oat wrapper

```
02-04 23:45:00.212  4396  4396 E LSPosedDex2Oat: failed to connect to /dev/c951326ba095346b/dex2oat.sock failed with 13: Permission denied
02-04 23:45:00.209  4396  4396 W dex2oat64: type=1400 audit(0.0:8403): avc: denied { write } for name="dex2oat.sock" dev="tmpfs" ino=26722 scontext=u:r:installd:s0 tcontext=u:object_r:magisk_file:s0 tclass=sock_file permissive=0
02-04 23:45:00.213  1510  3805 V installd: DexInv: --- END '/data/app/~~M2S57MD185N1tyyKQy9PKw==/com.google.android.gm-7Q68xrTQSACXisBuDI6oBg==/base.apk' --- status=0x 100, process failed
02-04 23:45:00.213  1510  3805 E installd: Dex2oat invocation for /data/app/~~M2S57MD185N1tyyKQy9PKw==/com.google.android.gm-7Q68xrTQSACXisBuDI6oBg==/base.apk failed: unspecified dex2oat error (256)
```

Additional rules first appeared in Magisk version 24000
2c44e1bb93
2023-02-06 00:19:55 +08:00

64 lines
2.4 KiB
Bash

#
# This file is part of LSPosed.
#
# LSPosed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# LSPosed is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2020 EdXposed Contributors
# Copyright (C) 2021 LSPosed Contributors
#
check_magisk_version() {
ui_print "- Magisk version: $MAGISK_VER_CODE"
if [ "$FLAVOR" == "riru" ] || [ "$FLAVOR" == "zygisk" ]; then
if [ "$MAGISK_VER_CODE" -lt 24000 ]; then
ui_print "*********************************************************"
ui_print "! Please install Magisk v24+"
abort "*********************************************************"
fi
else
ui_print "*********************************************************"
ui_print "! Unsupported flavor $FLAVOR"
abort "*********************************************************"
fi
}
require_new_android() {
ui_print "*********************************************************"
ui_print "! Unsupported Android version ${1} (below Oreo MR1)"
ui_print "! Learn more from our GitHub"
[ "$BOOTMODE" == "true" ] && am start -a android.intent.action.VIEW -d https://github.com/LSPosed/LSPosed/#supported-versions
abort "*********************************************************"
}
check_android_version() {
if [ "$API" -ge 27 ]; then
ui_print "- Android SDK version: $API"
else
require_new_android "$API"
fi
}
check_incompatible_module() {
MODULEDIR="$(magisk --path)/.magisk/modules"
for id in "riru_dreamland" "riru_edxposed" "riru_edxposed_sandhook" "taichi"; do
if [ -d "$MODULEDIR/$id" ] && [ ! -f "$MODULEDIR/$id/disable" ] && [ ! -f "$MODULEDIR/$id/remove" ]; then
ui_print "*********************************************************"
ui_print "! Please disable or uninstall incompatible frameworks:"
ui_print "! $id"
abort "*********************************************************"
break
fi
done
}