[Magisk] osm0sis:
Read

this

entire

post for context and instructions!

My latest script is

linked

at the

bottom

of this post!

Note the entire PlayIntegrityNEXT autojson pif.sh script here:

autojson/pif.sh at main · daboynb/autojson

Contribute to daboynb/autojson development by creating an account on GitHub.

github.com

Aaand oops, I reimplemented the whole thing in 4 7 lines, plus it does the processing entirely on your device now! 💪😏

Original 7 line script (for posterity):

/sdcard/Download/autopif.sh:

#!/system/bin/sh
# osm0sis @ xda-developers

[ -f apktool_2.0.3-dexed.jar ] || wget -q --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

apkurl=$(wget -q -O - --no-check-certificate https://sourceforge.net/projects/xiaomi-eu-multilang-miui-roms/rss?path=/xiaomi.eu/Xiaomi.eu-app | grep -o '<link>.*' | head -n 2 | tail -n 1 | sed 's;<link>\(.*\)</link>;\1;g')
apkname=$(echo $apkurl | sed 's;.*/\(.*\)/download;\1;g')
[ -f $apkname ] || wget -q --no-check-certificate -O $apkname $apkurl

outdir=$(basename $apkname .apk)
[ -d $outdir ] || dalvikvm -Xnoimage-dex2oat -cp apktool_2.0.3-dexed.jar brut.apktool.Main -q d -f --no-src -p $outdir -o $outdir $apkname

(echo '{'; grep -o '<field.*' $outdir/res/xml/inject_fields.xml | sed -e 's;.*name=\(".*"\) type.* value=\(".*"\).*; \1: \2,;g' -e '$s/,//'; echo '}') | tee pif.json

😆

Instructions

:

Simply sh autopif.sh from a root prompt wherever you place the script (it will work from /sdcard/Download/ even), or, run it using a file explorer app that supports script execution. Then move the correct generated file to the correct location for the PIF module you use.

Note: If using Termux make sure you're on the latest GitHub/F-Droid release and have run pkg upgrade at least once since installing Termux.

Edit history (for posterity/changelog):

Edit

: Added 3 lines and made it more robust to only download and process when there's a new Xiaomi.eu APK update! 😛

Now, someone feel free to make a Tasker APK out of that or something so there's literally no reason to use the awful "NEXT" fork that erased all our commit history/authorship. 🤬

Edit 2

: F*ck it. Fully fleshed it out into a complete tool which can be run from the command line or using a file explorer app that supports script execution.

Edit 3

: Updated it to automatically use migrate.sh to convert it to custom.pif.json for my fork if it's detected from my module being installed. And added a workaround to use Termux's dalvikvm wrapper since they don't use the real PATH at their root prompt.

Edit 4

: Added some error catching so people with bad connections are less confused when wget fails to download something.

Edit 5

: Tidied up the output and allowed it to self-contain the scratch files within a subdirectory when in the PIF module directory, as well as install the new file and kill GMS automatically. Now a part of PIFork directly!

Not going to paste it all again, but the latest version is linked. 🤘

The latest autopif.sh and killgms.sh are now part of my PIFork project (v9+)! You may still download the scripts individually as linked below:

https://github.com/osm0sis/PlayIntegrityFork/blob/main/module/autopif.sh

https://github.com/osm0sis/PlayIntegrityFork/blob/main/module/killgms.sh