More consistent replace file naming, retain custom through an update

This commit is contained in:
osm0sis
2024-01-09 10:52:17 -04:00
parent 05927c60e1
commit 21a309dd12
3 changed files with 29 additions and 25 deletions

View File

@@ -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