From 03c1053871e8e02e2d4b7a899f6aa5f7f60ce2c8 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Tue, 28 Apr 2020 00:32:00 -0300 Subject: [PATCH] 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 --- scripts/module_installer.sh | 4 +++- scripts/util_functions.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/module_installer.sh b/scripts/module_installer.sh index 2b391f8bb..f28aa9d2d 100644 --- a/scripts/module_installer.sh +++ b/scripts/module_installer.sh @@ -172,9 +172,11 @@ fi # Copy over custom sepolicy rules if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then 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 mkdir -p $PERSISTMOD - cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule + cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size" fi # Remove stuffs that don't belong to modules diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index d3bfc121c..24edda2cd 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -727,9 +727,11 @@ install_module() { # Copy over custom sepolicy rules if [ -f $MODPATH/sepolicy.rule -a -e "$PERSISTDIR" ]; then 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 mkdir -p $PERSISTMOD - cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule + cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size" fi # Remove stuffs that don't belong to modules