From 4bcf51ccfd6bff916c99511734bc67a120f35daf Mon Sep 17 00:00:00 2001 From: Chris Renshaw Date: Sat, 8 Feb 2025 19:57:37 -0400 Subject: [PATCH] autopif2.sh: use all instead of system if boot or vendor 11 months or more old --- module/autopif2.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module/autopif2.sh b/module/autopif2.sh index a722424..0a27c13 100644 --- a/module/autopif2.sh +++ b/module/autopif2.sh @@ -186,7 +186,16 @@ if [ "$DIR" = /data/adb/modules/playintegrityfix/autopif2 ]; then TS_SECPAT=/data/adb/tricky_store/security_patch.txt; if [ -f "$TS_SECPAT" ]; then item "Updating Tricky Store security_patch.txt ..."; - [ ! -s "$TS_SECPAT" ] && echo "system=" > $TS_SECPAT; + if [ ! -s "$TS_SECPAT" ]; then + LAST_STRONG_DATE="$(($(date '+%s') - 60 * 60 * 24 * 7 * 48))"; + CUR_BOOT_DATE="$(date -d "$(getprop ro.build.version.security_patch)" '+%s')"; + CUR_VENDOR_DATE="$(date -d "$(getprop ro.vendor.build.security_patch)" '+%s')"; + if [ "$CUR_BOOT_DATE" -lt "$LAST_STRONG_DATE" -o "$CUR_VENDOR_DATE" -lt "$LAST_STRONG_DATE" ]; then + echo "all=" > $TS_SECPAT; + else + echo "system=" > $TS_SECPAT; + fi; + fi; grep -q 'all=' $TS_SECPAT && sed -i "s/all=.*/all=$SECURITY_PATCH/" $TS_SECPAT; grep -q 'system=' $TS_SECPAT && sed -i "s/system=.*/system=$(echo ${SECURITY_PATCH//-} | cut -c-6)/" $TS_SECPAT; cat $TS_SECPAT;