

on post-fs-data && property:ro.boot.redroid_magisk=1
    start logd
    chmod 0755 /vendor/etc/init/magisk/magisk64
    chmod 0755 /vendor/etc/init/magisk/magiskpolicy
    exec u:r:su:s0 root root -- /vendor/etc/init/magisk/magisk64 --setup-sbin /vendor/etc/init/magisk
    exec u:r:su:s0 root root -- /vendor/etc/init/magisk/magiskpolicy --live --magisk "allow * magisk_file lnk_file *"
    mkdir /sbin/.magisk 700
    mkdir /sbin/.magisk/mirror 700
    mkdir /sbin/.magisk/block 700
    rm /dev/.magisk_unblock
    start 7zKkuZ1ZhD
    wait /dev/.magisk_unblock 40
    rm /dev/.magisk_unblock
    start wHgGlkRCtMoIQw

service 7zKkuZ1ZhD /sbin/magisk --post-fs-data
    user root
    seclabel u:r:su:s0
    oneshot
    disabled

service wHgGlkRCtMoIQw /sbin/magisk --service
    user root
    seclabel u:r:su:s0
    oneshot
    disabled

on property:sys.boot_completed=1 && property:ro.boot.redroid_magisk=1
    mkdir /data/adb/magisk 755
    exec u:r:su:s0 root root -- /sbin/magisk --boot-complete
    exec -- /system/bin/sh -c "if [ ! -e /data/data/io.github.huskydg.magisk ] ; then pm install /vendor/etc/init/magisk/magisk.apk ; fi"

on property:init.svc.zygote=restarting && property:ro.boot.redroid_magisk=1
    exec u:r:su:s0 root root -- /sbin/magisk --zygote-restart

on property:init.svc.zygote=stopped && property:ro.boot.redroid_magisk=1
    exec u:r:su:s0 root root -- /sbin/magisk --zygote-restart

