autopif.sh: install/output improvements

- back up old json if running as built-in to module
- keep Advanced Settings if present in old json
This commit is contained in:
Chris Renshaw
2024-05-11 09:10:13 -03:00
committed by GitHub
parent 2027b7ba74
commit 31adf6b3b9

View File

@@ -14,12 +14,6 @@ case "$0" in
esac;
DIR=$(dirname "$(readlink -f "$DIR")");
if [ "$DIR" = /data/adb/modules/playintegrityfix ]; then
DIR=$DIR/autopif;
mkdir -p $DIR;
fi;
cd "$DIR";
if ! which wget >/dev/null; then
if [ -f /data/adb/magisk/busybox ]; then
wget() { /data/adb/magisk/busybox wget "$@"; }
@@ -35,6 +29,12 @@ fi;
item() { echo "\n- $@"; }
if [ "$DIR" = /data/adb/modules/playintegrityfix ]; then
DIR=$DIR/autopif;
mkdir -p $DIR;
fi;
cd "$DIR";
if [ ! -f apktool_2.0.3-dexed.jar ]; then
item "Downloading Apktool ...";
wget --no-check-certificate -O apktool_2.0.3-dexed.jar https://github.com/osm0sis/APK-Patcher/raw/master/tools/apktool_2.0.3-dexed.jar 2>&1 || exit 1;
@@ -64,19 +64,27 @@ grep -o '<field.*' $OUT/res/xml/inject_fields.xml | sed 's;.*name=\(".*"\) type.
echo ' "FIRST_API_LEVEL": "25",' ) | sed '$s/,/\n}/' | tee pif.json;
if [ -f /data/adb/modules/playintegrityfix/migrate.sh ]; then
if [ -f /data/adb/modules/playintegrityfix/custom.pif.json ]; then
grep -qE "verboseLogs|VERBOSE_LOGS" /data/adb/modules/playintegrityfix/custom.pif.json && ARGS="-a";
fi;
item "Converting pif.json to custom.pif.json with migrate.sh:";
rm -f custom.pif.json;
sh /data/adb/modules/playintegrityfix/migrate.sh -i pif.json;
sh /data/adb/modules/playintegrityfix/migrate.sh -i $ARGS pif.json;
cat custom.pif.json;
fi;
if [ "$DIR" = /data/adb/modules/playintegrityfix/autopif ]; then
item "Installing new json ...";
if [ -f /data/adb/modules/playintegrityfix/migrate.sh ]; then
cp -fv custom.pif.json "$DIR/..";
NEWNAME="custom.pif.json";
else
cp -fv pif.json "$DIR/..";
NEWNAME="pif.json";
fi;
if [ -f "../$NEWNAME" ]; then
item "Renaming old file to $NEWNAME.bak ...";
mv -fv ../$NEWNAME ../$NEWNAME.bak;
fi;
item "Installing new json ...";
cp -fv $NEWNAME ..;
fi;
if [ -f /data/adb/modules/playintegrityfix/killgms.sh ]; then