change security patch logic

check if security patch is older than one year
This commit is contained in:
KOWX712
2025-02-07 21:53:50 +08:00
parent a4c08ba08c
commit e18871754f

View File

@@ -29,18 +29,27 @@ if [ -n "$hash_value" ]; then
resetprop -n ro.boot.vbmeta.digest "$hash_value" resetprop -n ro.boot.vbmeta.digest "$hash_value"
fi fi
# Reset vendor patch if different with security patch # Spoof security patch if older than 1 year
security_patch=$(getprop ro.build.version.security_patch) vendor_patch=$(getprop ro.vendor.build.security_patch | sed 's/-//g')
vendor_patch=$(getprop ro.vendor.build.security_patch) vendor_patch_after_1y=$(echo "$vendor_patch + 10000" | bc)
if [ "$vendor_patch" != "$security_patch" ]; then TODAY=$(date +%Y%m%d)
TS_version=$(grep "versionCode=" "$TS/module.prop" | cut -d'=' -f2) if [ "$TODAY" -ge "$vendor_patch_after_1y" ]; then
if [ "$TS_version" -lt 158 ]; then [ -f "/data/adb/modules/playintegrityfix/pif.json" ] && PIF="/data/adb/modules/playintegrityfix/pif.json"
resetprop -n ro.vendor.build.security_patch "$security_patch" [ -f "/data/adb/pif.json" ] && PIF="/data/adb/pif.json"
else [ -f "/data/adb/modules/playintegrityfix/custom.pif.json" ] && PIF="/data/adb/modules/playintegrityfix/custom.pif.json"
printf "boot=%s\nvendor=%s\n" "$security_patch" "$security_patch" > "$TARGET_DIR/security_patch.txt" security_patch=$(grep '"SECURITY_PATCH"' "$PIF" | sed 's/.*: "//; s/".*//')
[ -z "$security_patch" ] && security_patch=$(getprop ro.build.version.security_patch)
formatted_security_patch=$(echo "$security_patch" | sed 's/-//g')
if [ -n "$formatted_security_patch" ]; then
TS_version=$(grep "versionCode=" "$TS/module.prop" | cut -d'=' -f2)
if [ "$TS_version" -lt 158 ]; then
resetprop ro.vendor.build.security_patch "$security_patch"
resetprop ro.build.version.security_patch "$security_patch"
else
echo "all=$formatted_security_patch" > "$TARGET_DIR/security_patch.txt"
fi
fi fi
else
rm -f "$TARGET_DIR/security_patch.txt"
fi fi
# Disable TSupport-A auto update target to prevent overwrite # Disable TSupport-A auto update target to prevent overwrite