scripts: fix persist out-of-space copying sepolicy.rule

- bugged TWRPs were filling persist with recovery logs, so clean those as a potential workaround
- abort module install if sepolicy.rule fails to copy, since 99% of the time the module wouldn't include it if it could function without it

Closes #2461
This commit is contained in:
osm0sis 2020-04-28 00:32:00 -03:00 committed by John Wu
parent c7ed0ef5eb
commit 03c1053871
2 changed files with 6 additions and 2 deletions

View File

@ -172,9 +172,11 @@ fi
# Copy over custom sepolicy rules # Copy over custom sepolicy rules
if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then
ui_print "- Installing custom sepolicy patch" ui_print "- Installing custom sepolicy patch"
# Remove old recovery logs (which may be filling partition) to make room
rm -f $PERSISTDIR/cache/recovery/*
PERSISTMOD=$PERSISTDIR/magisk/$MODID PERSISTMOD=$PERSISTDIR/magisk/$MODID
mkdir -p $PERSISTMOD mkdir -p $PERSISTMOD
cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size"
fi fi
# Remove stuffs that don't belong to modules # Remove stuffs that don't belong to modules

View File

@ -727,9 +727,11 @@ install_module() {
# Copy over custom sepolicy rules # Copy over custom sepolicy rules
if [ -f $MODPATH/sepolicy.rule -a -e "$PERSISTDIR" ]; then if [ -f $MODPATH/sepolicy.rule -a -e "$PERSISTDIR" ]; then
ui_print "- Installing custom sepolicy patch" ui_print "- Installing custom sepolicy patch"
# Remove old recovery logs (which may be filling partition) to make room
rm -f $PERSISTDIR/cache/recovery/*
PERSISTMOD=$PERSISTDIR/magisk/$MODID PERSISTMOD=$PERSISTDIR/magisk/$MODID
mkdir -p $PERSISTMOD mkdir -p $PERSISTMOD
cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size"
fi fi
# Remove stuffs that don't belong to modules # Remove stuffs that don't belong to modules