magisk: Add service script for MagiskHide device indicators

This functionality has been removed from Magisk:
003fea52b1

Simple properties are set in system.prop, but more advanced overrides
need to be handled by a script.
This commit is contained in:
Danny Lin 2021-09-06 04:02:27 -07:00
parent bcf9a767c4
commit 791884862a
No known key found for this signature in database
GPG Key ID: 1988FAA1797EE5AC
2 changed files with 30 additions and 0 deletions

View File

@ -38,6 +38,8 @@ ui_print "- Extracting module files"
extract "$ZIPFILE" 'module.prop' "$MODPATH"
extract "$ZIPFILE" 'classes.dex' "$MODPATH"
extract "$ZIPFILE" 'service.sh' "$MODPATH"
chmod 755 "$MODPATH/service.sh"
# Riru v24+ load files from the "riru" folder in the Magisk module folder
# This "riru" folder is also used to determine if a Magisk module is a Riru module

View File

@ -0,0 +1,28 @@
#!/system/bin/sh
maybe_set_prop() {
local prop="$1"
local contains="$2"
local value="$3"
if [[ "$(getprop "$prop")" == *"$contains"* ]]; then
resetprop "$prop" "$value"
fi
}
# Magisk recovery mode
maybe_set_prop ro.bootmode recovery unknown
maybe_set_prop ro.boot.mode recovery unknown
maybe_set_prop vendor.boot.mode recovery unknown
# MIUI region
maybe_set_prop ro.boot.hwc CN GLOBAL
maybe_set_prop ro.boot.hwcountry China GLOBAL
resetprop --delete ro.build.selinux
# SELinux permissive
if [[ "$(cat /sys/fs/selinux/enforce)" == "0" ]]; then
chmod 640 /sys/fs/selinux/enforce
chmod 440 /sys/fs/selinux/policy
fi