diff --git a/riru/template/magisk_module/customize.sh b/riru/template/magisk_module/customize.sh index d89666e..42ab0a9 100644 --- a/riru/template/magisk_module/customize.sh +++ b/riru/template/magisk_module/customize.sh @@ -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 diff --git a/riru/template/magisk_module/service.sh b/riru/template/magisk_module/service.sh new file mode 100644 index 0000000..a8a8fb0 --- /dev/null +++ b/riru/template/magisk_module/service.sh @@ -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