Skip to content

Commit 68f2a38

Browse files
committed
fix: autopif update
since google no longer exposing beta rom after October and old autopif still seems to work, let's just use it.
1 parent e7836cb commit 68f2a38

3 files changed

Lines changed: 60 additions & 25 deletions

File tree

.github/workflows/autopif.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
ota_hash: ${{ steps.get_info.outputs.ota_hash }}
2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@v5
23+
uses: actions/checkout@v6
2424
with:
2525
fetch-depth: 1
2626
ref: bot
@@ -34,13 +34,16 @@ jobs:
3434
download https://developer.android.com/about/versions PIXEL_VERSIONS_HTML
3535
download "$(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n1)" PIXEL_LATEST_HTML
3636
download "https://developer.android.com$(grep -o 'href=".*download-ota.*"' PIXEL_LATEST_HTML | grep 'qpr' | cut -d\" -f2 | head -n1)" PIXEL_OTA_HTML
37+
download https://developer.android.com/topic/generic-system-image/releases PIXEL_GSI_HTML
3738
3839
# Extract device information
3940
grep -A1 'tr id=' PIXEL_OTA_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;' > MODEL_LIST
4041
grep -o 'tr id="[^\"]*"' PIXEL_OTA_HTML | awk -F\" '{print $2 "_beta"}' > PRODUCT_LIST
4142
grep 'ota/.*_beta' PIXEL_OTA_HTML | cut -d\" -f2 > OTA_LIST
43+
grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o '/versions/.*' | cut -d/ -f3 > RELEASE
4244
43-
CURRENT_HASH=$(sha256sum OTA_LIST | cut -d' ' -f1)
45+
# CURRENT_HASH=$(sha256sum OTA_LIST | cut -d' ' -f1)
46+
CURRENT_HASH=$(sha256sum RELEASE | cut -d' ' -f1)
4447
LAST_HASH=$(cat ../HASH || echo '')
4548
4649
if [ "$CURRENT_HASH" == "$LAST_HASH" ] && [ "${{ github.event.inputs.force_update }}" != "true" ]; then
@@ -63,7 +66,7 @@ jobs:
6366

6467
steps:
6568
- name: Checkout repository
66-
uses: actions/checkout@v5
69+
uses: actions/checkout@v6
6770
with:
6871
fetch-depth: 1
6972
ref: bot
@@ -82,8 +85,9 @@ jobs:
8285
run: |
8386
model="${{ matrix.model }}"
8487
product="${{ matrix.product }}"
85-
ota_link="${{ matrix.ota_link }}"
88+
# ota_link="${{ matrix.ota_link }}"
8689
90+
##############################################################################################################################
8791
# Download avbtool
8892
# curl -Ls https://android.googlesource.com/platform/external/avb/+/master/avbtool.py?format=TEXT | base64 -d > avbtool.py
8993
@@ -97,9 +101,34 @@ jobs:
97101
# DIGEST=$(avbtool calculate_vbmeta_digest --image vbmeta.img)
98102
99103
# Get other information
100-
payload_dumper --metadata --out . "$ota_link"
101-
FINGERPRINT=$(grep -am1 'post-build=' metadata | cut -d= -f2)
102-
SECURITY_PATCH=$(grep -am1 'security-patch-level=' metadata | cut -d= -f2)
104+
# payload_dumper --metadata --out . "$ota_link"
105+
# FINGERPRINT=$(grep -am1 'post-build=' metadata | cut -d= -f2)
106+
# SECURITY_PATCH=$(grep -am1 'security-patch-level=' metadata | cut -d= -f2)
107+
##############################################################################################################################
108+
109+
download() { wget -T 20 --no-check-certificate "$1" -O "$2"; }
110+
111+
# Get fingerprint detail
112+
download https://developer.android.com/topic/generic-system-image/releases PIXEL_GSI_HTML
113+
RELEASE="$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o '/versions/.*' | cut -d/ -f3)"
114+
ID="$(grep -m1 -o 'Build:.*' PIXEL_GSI_HTML | cut -d' ' -f2)"
115+
INCREMENTAL="$(grep -m1 -o "$ID-.*-" PIXEL_GSI_HTML | cut -d- -f2)"
116+
117+
# Get security patch
118+
download https://source.android.com/docs/security/bulletin/pixel PIXEL_SECBULL_HTML
119+
SECURITY_PATCH="$(grep -A15 "$(grep -m1 -o 'Security patch level:.*' PIXEL_GSI_HTML | cut -d' ' -f4-)" PIXEL_SECBULL_HTML | grep -m1 -B1 '</tr>' | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;')"
120+
121+
DEVICE=$(echo "$product" | sed 's/_beta//')
122+
FINGERPRINT="google/$product/$DEVICE:$RELEASE/$ID/$INCREMENTAL:user/release-keys"
123+
124+
# Validate required fields
125+
required="model product DEVICE RELEASE ID INCREMENTAL SECURITY_PATCH"
126+
for i in $required; do
127+
if [ -z "${!i}" ]; then
128+
echo "Missing $i"
129+
exit 1
130+
fi
131+
done
103132
104133
cat <<EOF > ../${product}.prop
105134
FINGERPRINT=$FINGERPRINT
@@ -120,7 +149,7 @@ jobs:
120149
runs-on: ubuntu-latest
121150
steps:
122151
- name: Checkout repository
123-
uses: actions/checkout@v5
152+
uses: actions/checkout@v6
124153
with:
125154
fetch-depth: 1
126155
ref: bot

module/autopif.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,34 @@ if [ "$1" = "--list" ] || [ "$1" = "-l" ]; then
7373
get_model_product_list
7474
fi
7575

76+
# Get fingerprint detail
77+
download https://developer.android.com/topic/generic-system-image/releases PIXEL_GSI_HTML
78+
RELEASE="$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o '/versions/.*' | cut -d/ -f3)"
79+
ID="$(grep -m1 -o 'Build:.*' PIXEL_GSI_HTML | cut -d' ' -f2)"
80+
INCREMENTAL="$(grep -m1 -o "$ID-.*-" PIXEL_GSI_HTML | cut -d- -f2)"
81+
82+
# Get security patch
83+
download https://source.android.com/docs/security/bulletin/pixel PIXEL_SECBULL_HTML
84+
SECURITY_PATCH="$(grep -A15 "$(grep -m1 -o 'Security patch level:.*' PIXEL_GSI_HTML | cut -d' ' -f4-)" PIXEL_SECBULL_HTML | grep -m1 -B1 '</tr>' | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;')"
85+
7686
# Select and configure device
7787
echo "- Selecting Pixel Beta device ..."
7888
if [ -z "$PRODUCT" ] || ! echo "$PRODUCT_LIST" | grep -q "$PRODUCT"; then
7989
set_random_beta
8090
fi
8191
echo "$MODEL ($PRODUCT)"
92+
DEVICE=$(echo "$PRODUCT" | sed 's/_beta//')
93+
94+
# Validate required field
95+
required="MODEL PRODUCT DEVICE RELEASE ID INCREMENTAL SECURITY_PATCH"
96+
for i in $required; do
97+
eval "value=\${$i}"
98+
if [ -z "$value" ]; then
99+
download_fail "https://dl.google.com"
100+
fi
101+
done
82102

83-
# Get device fingerprint and security patch from OTA metadata
84-
OTA_LINK="$(echo "$OTA_LIST" | grep "$PRODUCT")"
85-
if command -v curl > /dev/null 2>&1; then
86-
curl --connect-timeout 10 -s "$OTA_LINK" | strings | head -n15 > PIXEL_ZIP_METADATA || download_fail "$OTA_LINK"
87-
else
88-
busybox wget -T 10 --no-check-certificate -qO - "$OTA_LINK" | strings | head -n15 > PIXEL_ZIP_METADATA || download_fail "$OTA_LINK"
89-
fi
90-
FINGERPRINT="$(grep -am1 'post-build=' PIXEL_ZIP_METADATA | cut -d= -f2)"
91-
SECURITY_PATCH="$(grep -am1 'security-patch-level=' PIXEL_ZIP_METADATA | cut -d= -f2)"
92-
93-
# Validate required field to prevent empty pif.prop
94-
if [ -z "$FINGERPRINT" ] || [ -z "$SECURITY_PATCH" ]; then
95-
# link to download pixel rom metadata
96-
download_fail "https://dl.google.com"
97-
fi
103+
FINGERPRINT="google/$PRODUCT/$DEVICE:$RELEASE/$ID/$INCREMENTAL:user/release-keys"
98104

99105
# Preserve previous setting
100106
spoofConfig="spoofBuild spoofProps spoofProvider spoofSignature spoofVendingBuild spoofVendingSdk DEBUG"

webui/assets/scripts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,8 @@ function checkPropDate() {
556556
prop_epoch="$(busybox date -d "$prop_date" +%s)"
557557
current_epoch="$(busybox date +%s)"
558558
different="$(($current_epoch - $prop_epoch))"
559-
if [ $different -gt 5184000 ]; then
560-
# 60d * 24h * 60m * 60s = 5184000
559+
if [ $different -gt 7776000 ]; then
560+
# 90d * 24h * 60m * 60s = 7776000
561561
echo "outdated"
562562
fi
563563
`, { env: { PATH: "$PATH:/data/adb/ap/bin:/data/adb/ksu/bin:/data/adb/magisk" }}).then((result) => {

0 commit comments

Comments
 (0)