From 38ea9851bd95a846e6a6d715240b20fadd3d1489 Mon Sep 17 00:00:00 2001 From: Chris Renshaw Date: Fri, 7 Feb 2025 18:55:29 +0800 Subject: [PATCH 1/6] upstream autopif2 from PIFork fix broken pif.json --- module/action.sh | 72 +++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/module/action.sh b/module/action.sh index a007138..c3cec9c 100644 --- a/module/action.sh +++ b/module/action.sh @@ -1,7 +1,8 @@ #!/bin/sh + PATH=/data/adb/ap/bin:/data/adb/ksu/bin:/data/adb/magisk:/data/data/com.termux/files/usr/bin:$PATH MODDIR=/data/adb/modules/playintegrityfix -version=$(grep "^version=" $MODDIR/module.prop | sed 's/version=//g' ) +version=$(grep "^version=" $MODDIR/module.prop | sed 's/version=//g') echo "[+] PlayIntegrityFix $version" echo "[+] $(basename "$0")" @@ -9,11 +10,12 @@ printf "\n\n" download_fail() { dl_domain=$(echo "$1" | awk -F[/:] '{print $4}') + echo "$1" | grep -q "\.zip$" && return ping -c 1 -W 5 "$dl_domain" > /dev/null 2>&1 || { echo "[!] Unable to connect to $dl_domain, please check your internet connection and try again" sleep_pause exit 1 - } + } conflict_module=$(ls /data/adb/modules | grep busybox) for i in $conflict_module; do echo "[!] Please remove $conflict_module and try again." @@ -32,21 +34,21 @@ fi sleep_pause() { # APatch and KernelSU needs this if [ -z "$MMRL" ] && { [ "$KSU" = "true" ] || [ "$APATCH" = "true" ]; }; then - sleep 5 + sleep 2 fi } set_random_beta() { - if [ "$(echo "$MODEL_LIST" | wc -l)" -ne "$(echo "$PRODUCT_LIST" | wc -l)" ]; then - echo "Error: MODEL_LIST and PRODUCT_LIST have different lengths." - sleep_pause - exit 1 - fi - count=$(echo "$MODEL_LIST" | wc -l) - rand_index=$(( $$ % count )) - MODEL=$(echo "$MODEL_LIST" | sed -n "$((rand_index + 1))p") - PRODUCT=$(echo "$PRODUCT_LIST" | sed -n "$((rand_index + 1))p") - DEVICE=$(echo "$PRODUCT" | sed 's/_beta//') + if [ "$(echo "$MODEL_LIST" | wc -l)" -ne "$(echo "$PRODUCT_LIST" | wc -l)" ]; then + echo "Error: MODEL_LIST and PRODUCT_LIST have different lengths." + sleep_pause + exit 1 + fi + count=$(echo "$MODEL_LIST" | wc -l) + rand_index=$(( $$ % count )) + MODEL=$(echo "$MODEL_LIST" | sed -n "$((rand_index + 1))p") + PRODUCT=$(echo "$PRODUCT_LIST" | sed -n "$((rand_index + 1))p") + DEVICE=$(echo "$PRODUCT" | sed 's/_beta//') } # lets try to use tmpfs for processing @@ -56,34 +58,40 @@ TEMPDIR="$MODDIR/temp" #fallback mkdir -p "$TEMPDIR" cd "$TEMPDIR" -download https://developer.android.com/topic/generic-system-image/releases PIXEL_GSI_HTML -grep -m1 -o 'li>.*(Beta)' PIXEL_GSI_HTML | cut -d\> -f2 -grep -m1 -o 'Date:.*' PIXEL_GSI_HTML +# Get latest Pixel Beta information +download https://developer.android.com/about/versions PIXEL_VERSIONS_HTML +BETA_URL=$(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n1) +download "$BETA_URL" PIXEL_LATEST_HTML -current_timestamp=$(date +%s) -threshold_timestamp=1740312000 # Baklava still not name as 16. TODO: Need to know what is the actually time of changeing the name of release. -if [ "$current_timestamp" -lt "$threshold_timestamp" ]; then - RELEASE="Baklava" +# Handle Developer Preview vs Beta +if grep -qE 'Developer Preview|tooltip>.*preview program' PIXEL_LATEST_HTML; then + # Use the second latest version for beta + BETA_URL=$(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n2 | tail -n1) + download "$BETA_URL" PIXEL_BETA_HTML else - RELEASE="$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o '/versions/.*' | cut -d/ -f3)" + mv -f PIXEL_LATEST_HTML PIXEL_BETA_HTML fi -ID="$(grep -m1 -o 'Build:.*' PIXEL_GSI_HTML | cut -d' ' -f2)" -INCREMENTAL="$(grep -m1 -o "$ID-.*-" PIXEL_GSI_HTML | cut -d- -f2)" -download "https://developer.android.com$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o 'href.*' | cut -d\" -f2)" PIXEL_GET_HTML -download "https://developer.android.com$(grep -m1 'Pixel downloads page' PIXEL_GET_HTML | grep -o 'href.*' | cut -d\" -f2)" PIXEL_BETA_HTML +# Get OTA information +OTA_URL="https://developer.android.com$(grep -o 'href=".*download-ota.*"' PIXEL_BETA_HTML | cut -d\" -f2 | head -n1)" +download "$OTA_URL" PIXEL_OTA_HTML -MODEL_LIST="$(grep -A1 'tr id=' PIXEL_BETA_HTML | grep 'td' | sed 's;.*\(.*\);\1;')" -PRODUCT_LIST="$(grep -o 'factory/.*_beta' PIXEL_BETA_HTML | cut -d/ -f2)" - -download https://source.android.com/docs/security/bulletin/pixel PIXEL_SECBULL_HTML - -SECURITY_PATCH="$(grep -A15 "$(grep -m1 -o 'Security patch level:.*' PIXEL_GSI_HTML | cut -d' ' -f4-)" PIXEL_SECBULL_HTML | grep -m1 -B1 '' | grep 'td' | sed 's;.*\(.*\);\1;')" +# Extract device information +MODEL_LIST="$(grep -A1 'tr id=' PIXEL_OTA_HTML | grep 'td' | sed 's;.*\(.*\);\1;')" +PRODUCT_LIST="$(grep -o 'ota/.*_beta' PIXEL_OTA_HTML | cut -d\/ -f2)" +OTA_LIST="$(grep 'ota/.*_beta' PIXEL_OTA_HTML | cut -d\" -f2)" +# Select and configure device echo "- Selecting Pixel Beta device ..." [ -z "$PRODUCT" ] && set_random_beta echo "$MODEL ($PRODUCT)" +# Get device fingerprint and security patch from OTA metadata +(ulimit -f 2; download "$(echo "$OTA_LIST" | grep "$PRODUCT")" PIXEL_ZIP_METADATA) +FINGERPRINT="$(grep -am1 'post-build=' PIXEL_ZIP_METADATA | cut -d= -f2)" +SECURITY_PATCH="$(grep -am1 'security-patch-level=' PIXEL_ZIP_METADATA | cut -d= -f2)" + +# Get device SDK version sdk_version="$(getprop ro.build.version.sdk)" sdk_version="${sdk_version:-25}" echo "Device SDK version: $sdk_version" @@ -91,7 +99,7 @@ echo "Device SDK version: $sdk_version" echo "- Dumping values to pif.json ..." cat < Date: Fri, 7 Feb 2025 20:12:35 +0800 Subject: [PATCH 2/6] final touch up --- module/action.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/module/action.sh b/module/action.sh index c3cec9c..3f21642 100644 --- a/module/action.sh +++ b/module/action.sh @@ -48,7 +48,6 @@ set_random_beta() { rand_index=$(( $$ % count )) MODEL=$(echo "$MODEL_LIST" | sed -n "$((rand_index + 1))p") PRODUCT=$(echo "$PRODUCT_LIST" | sed -n "$((rand_index + 1))p") - DEVICE=$(echo "$PRODUCT" | sed 's/_beta//') } # lets try to use tmpfs for processing @@ -87,9 +86,9 @@ echo "- Selecting Pixel Beta device ..." echo "$MODEL ($PRODUCT)" # Get device fingerprint and security patch from OTA metadata -(ulimit -f 2; download "$(echo "$OTA_LIST" | grep "$PRODUCT")" PIXEL_ZIP_METADATA) -FINGERPRINT="$(grep -am1 'post-build=' PIXEL_ZIP_METADATA | cut -d= -f2)" -SECURITY_PATCH="$(grep -am1 'security-patch-level=' PIXEL_ZIP_METADATA | cut -d= -f2)" +(ulimit -f 2; download "$(echo "$OTA_LIST" | grep "$PRODUCT")" PIXEL_ZIP_METADATA) >/dev/null 2>&1 +FINGERPRINT="$(strings PIXEL_ZIP_METADATA | grep -am1 'post-build=' | cut -d= -f2)" +SECURITY_PATCH="$(strings PIXEL_ZIP_METADATA | grep -am1 'security-patch-level=' | cut -d= -f2)" # Get device SDK version sdk_version="$(getprop ro.build.version.sdk)" From 0e52fb5e71cf547c8ef4634654fe1b83aa304abf Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Mon, 10 Feb 2025 23:41:18 +0800 Subject: [PATCH 3/6] scripts/action: do NOT sleep on KSU_NEXT ksu next does NOT auto close --- module/action.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/module/action.sh b/module/action.sh index 3f21642..d5d9659 100644 --- a/module/action.sh +++ b/module/action.sh @@ -8,6 +8,14 @@ echo "[+] PlayIntegrityFix $version" echo "[+] $(basename "$0")" printf "\n\n" +sleep_pause() { + # APatch and KernelSU needs this + # but not KSU_NEXT, MMRL + if [ -z "$MMRL" ] && [ -z "$KSU_NEXT" ] && { [ "$KSU" = "true" ] || [ "$APATCH" = "true" ]; }; then + sleep 5 + fi +} + download_fail() { dl_domain=$(echo "$1" | awk -F[/:] '{print $4}') echo "$1" | grep -q "\.zip$" && return @@ -31,13 +39,6 @@ if command -v curl > /dev/null 2>&1; then download() { curl --connect-timeout 10 -s "$1" > "$2" || download_fail "$1"; } fi -sleep_pause() { - # APatch and KernelSU needs this - if [ -z "$MMRL" ] && { [ "$KSU" = "true" ] || [ "$APATCH" = "true" ]; }; then - sleep 2 - fi -} - set_random_beta() { if [ "$(echo "$MODEL_LIST" | wc -l)" -ne "$(echo "$PRODUCT_LIST" | wc -l)" ]; then echo "Error: MODEL_LIST and PRODUCT_LIST have different lengths." From 17aa9a00357033b4c2f33a3603e095b6b37afa83 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Thu, 13 Feb 2025 14:20:44 +0800 Subject: [PATCH 4/6] scripts: disable LeafOS gmscompat if found This also properly cleans it up at uninstall. Some LineageOS based roms use this pif implementation. --- module/post-fs-data.sh | 8 ++++++++ module/uninstall.sh | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 module/uninstall.sh diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index eb84c4c..7eaa466 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -53,3 +53,11 @@ if [ -n "$(resetprop persist.sys.pixelprops.pi)" ]; then resetprop -n -p persist.sys.pixelprops.gapps false resetprop -n -p persist.sys.pixelprops.gms false fi + +# LeafOS "gmscompat: Dynamically spoof props for GMS" +# https://review.leafos.org/c/LeafOS-Project/android_frameworks_base/+/4416 +# https://review.leafos.org/c/LeafOS-Project/android_frameworks_base/+/4417/5 +if [ -f /data/system/gms_certified_props.json ] && [ ! "$(resetprop persist.sys.spoof.gms)" = "false" ]; then + resetprop persist.sys.spoof.gms false +fi + diff --git a/module/uninstall.sh b/module/uninstall.sh new file mode 100644 index 0000000..d248079 --- /dev/null +++ b/module/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# LeafOS "gmscompat: Dynamically spoof props for GMS" +# https://review.leafos.org/c/LeafOS-Project/android_frameworks_base/+/4416 +# https://review.leafos.org/c/LeafOS-Project/android_frameworks_base/+/4417/5 +if [ -f /data/system/gms_certified_props.json ]; then + resetprop -p --delete persist.sys.spoof.gms +fi + +# EOF From 27cb00dd98b304ebefb5715bcadeb8ba13a3252b Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:53:28 +0800 Subject: [PATCH 5/6] scrtips/action: add /dev as tmpfs option to support APatch .litemode_enable and MKSU .notmpfs --- module/action.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/module/action.sh b/module/action.sh index d5d9659..a17e23a 100644 --- a/module/action.sh +++ b/module/action.sh @@ -55,6 +55,7 @@ set_random_beta() { TEMPDIR="$MODDIR/temp" #fallback [ -w /sbin ] && TEMPDIR="/sbin/playintegrityfix" [ -w /debug_ramdisk ] && TEMPDIR="/debug_ramdisk/playintegrityfix" +[ -w /dev ] && TEMPDIR="/dev/playintegrityfix" mkdir -p "$TEMPDIR" cd "$TEMPDIR" From 11d1415636a97394dffa8dc31ebf8fdb4266c83d Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Thu, 20 Feb 2025 07:50:34 +0800 Subject: [PATCH 6/6] scripts/customize: dont remove action-on-webui some folks might prefer this, since it does NOT auto close. --- module/customize.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/module/customize.sh b/module/customize.sh index 94ac8a8..87a2c40 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -69,10 +69,3 @@ fi # give exec perm to action.sh chmod +x "$MODPATH/action.sh" -# action.sh, ap 10927, ksu 11981 -if { [ "$KSU" = "true" ] && [ "$KSU_VER_CODE" -ge 11981 ]; } || - { [ "$APATCH" = "true" ] && [ "$APATCH_VER_CODE" -ge 10927 ]; }; then - # we dont need the webui workaround - # since manager has action - rm -rf "$MODPATH/webroot" -fi