update copy_preinit_files

This commit is contained in:
vvb2060 2024-07-18 06:53:11 +08:00 committed by John Wu
parent d54baadbed
commit 9a00b7b942

View File

@ -568,16 +568,12 @@ run_migrations() {
} }
copy_preinit_files() { copy_preinit_files() {
local PREINITDIR=$(magisk --path)/.magisk/preinit local PREINITDIR=$MAGISKTMP/.magisk/preinit
if ! grep -q " $PREINITDIR " /proc/mounts; then if [ ! -d $PREINITDIR ]; then
ui_print "- Unable to find preinit dir" ui_print "- Unable to find preinit dir"
return 1 return 1
fi fi
if ! grep -q "/adb/modules $PREINITDIR " /proc/self/mountinfo; then
rm -rf $PREINITDIR/*
fi
# Copy all enabled sepolicy.rule # Copy all enabled sepolicy.rule
for r in $NVBASE/modules*/*/sepolicy.rule; do for r in $NVBASE/modules*/*/sepolicy.rule; do
[ -f "$r" ] || continue [ -f "$r" ] || continue
@ -585,10 +581,9 @@ copy_preinit_files() {
[ -f $MODDIR/disable ] && continue [ -f $MODDIR/disable ] && continue
[ -f $MODDIR/remove ] && continue [ -f $MODDIR/remove ] && continue
[ -f $MODDIR/update ] && continue [ -f $MODDIR/update ] && continue
local MODNAME=${MODDIR##*/} cat $r
mkdir -p $PREINITDIR/$MODNAME echo
cp -f $r $PREINITDIR/$MODNAME/sepolicy.rule done > $PREINITDIR/0/sepolicy.rule
done
} }
################# #################