From 9a00b7b94299aaab4e1c957495042daa627b2733 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Thu, 18 Jul 2024 06:53:11 +0800 Subject: [PATCH] update copy_preinit_files --- scripts/util_functions.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index 923a15b6c..e244d6c92 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -568,16 +568,12 @@ run_migrations() { } copy_preinit_files() { - local PREINITDIR=$(magisk --path)/.magisk/preinit - if ! grep -q " $PREINITDIR " /proc/mounts; then + local PREINITDIR=$MAGISKTMP/.magisk/preinit + if [ ! -d $PREINITDIR ]; then ui_print "- Unable to find preinit dir" return 1 fi - if ! grep -q "/adb/modules $PREINITDIR " /proc/self/mountinfo; then - rm -rf $PREINITDIR/* - fi - # Copy all enabled sepolicy.rule for r in $NVBASE/modules*/*/sepolicy.rule; do [ -f "$r" ] || continue @@ -585,10 +581,9 @@ copy_preinit_files() { [ -f $MODDIR/disable ] && continue [ -f $MODDIR/remove ] && continue [ -f $MODDIR/update ] && continue - local MODNAME=${MODDIR##*/} - mkdir -p $PREINITDIR/$MODNAME - cp -f $r $PREINITDIR/$MODNAME/sepolicy.rule - done + cat $r + echo + done > $PREINITDIR/0/sepolicy.rule } #################