From 21a309dd12b2e3f1e278d713906f4e116be9a73e Mon Sep 17 00:00:00 2001 From: osm0sis Date: Tue, 9 Jan 2024 10:52:17 -0400 Subject: [PATCH] More consistent replace file naming, retain custom through an update --- module/customize.sh | 34 ++++++++++--------- ..._replace.list => example.app_replace.list} | 2 ++ module/post-fs-data.sh | 18 +++++----- 3 files changed, 29 insertions(+), 25 deletions(-) rename module/{app_replace.list => example.app_replace.list} (81%) diff --git a/module/customize.sh b/module/customize.sh index 89deccf..9495d95 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -3,6 +3,14 @@ if [ "$API" -lt 26 ]; then abort "! You can't use this module on Android < 8.0" fi +# Copy any supported custom files to updated module +for FILE in custom.app_replace.list custom.pif.json; do + if [ -f "/data/adb/modules/playintegrityfix/$FILE" ]; then + ui_print "- Restoring $FILE" + cp -af /data/adb/modules/playintegrityfix/$FILE $MODPATH/$FILE + fi +done + # Remove/warn if conflicting modules are installed if [ -d /data/adb/modules/safetynet-fix ]; then touch /data/adb/modules/safetynet-fix/remove @@ -13,22 +21,16 @@ if [ -d /data/adb/modules/MagiskHidePropsConf ]; then fi # Replace conflicting custom ROM injection app folders to disable them -if [ -f "$MODPATH/app_replace.list" ]; then - for APP in $(grep -v '^#' "$MODPATH/app_replace.list"); do - if [ -d "$APP" ]; then - HIDEDIR="$MODPATH/$APP" - mkdir -p "$HIDEDIR" - touch "$HIDEDIR/.replace" - ui_print "- $(basename $APP) app disabled" - fi - done -fi - -# Copy any custom.pif.json to updated module -if [ -f /data/adb/modules/playintegrityfix/custom.pif.json ]; then - ui_print "- Restoring custom.pif.json" - cp -af /data/adb/modules/playintegrityfix/custom.pif.json $MODPATH/custom.pif.json -fi +LIST=$MODPATH/example.app_replace.list +[ -f "$MODPATH/custom.app_replace.list" ] && LIST=$MODPATH/custom.app_replace.list +for APP in $(grep -v '^#' $LIST); do + if [ -d "$APP" ]; then + HIDEDIR=$MODPATH/$APP + mkdir -p $HIDEDIR + touch $HIDEDIR/.replace + ui_print "! $(basename $APP) ROM app disabled" + fi +done # Migrate custom.pif.json to latest defaults if needed if [ -f "$MODPATH/custom.pif.json" ] && ! grep -q "api_level" $MODPATH/custom.pif.json; then diff --git a/module/app_replace.list b/module/example.app_replace.list similarity index 81% rename from module/app_replace.list rename to module/example.app_replace.list index 7d66a9a..bdde561 100644 --- a/module/app_replace.list +++ b/module/example.app_replace.list @@ -1,3 +1,5 @@ +# Rename to custom.app_replace.list once customized +# # Add conflicting custom ROM injection app folder paths to this list # and they will be replaced systemlessly to disable them diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index 189d0e0..970bd8d 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -12,15 +12,15 @@ if [ -d /data/adb/modules/safetynet-fix ]; then fi # Replace conflicting custom ROM injection app folders to disable them -if [ -f "$MODDIR/app_replace.list" ]; then - for APP in $(grep -v '^#' "$MODDIR/app_replace.list"); do - if [ -d "$APP" ]; then - HIDEDIR="$MODDIR/$APP" - mkdir -p "$HIDEDIR" - touch "$HIDEDIR/.replace" - fi - done -fi +LIST=$MODDIR/example.app_replace.list +[ -f "$MODDIR/custom.app_replace.list" ] && LIST=$MODDIR/custom.app_replace.list +for APP in $(grep -v '^#' $LIST); do + if [ -d "$APP" ]; then + HIDEDIR=$MODDIR/$APP + mkdir -p $HIDEDIR + touch $HIDEDIR/.replace + fi +done # Conditional early sensitive properties