Skip to content

Commit 8f7e30d

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 7001d4d commit 8f7e30d

2 files changed

Lines changed: 54 additions & 22 deletions

File tree

.github/workflows/autopif.yml

Lines changed: 33 additions & 7 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
@@ -63,7 +63,7 @@ jobs:
6363

6464
steps:
6565
- name: Checkout repository
66-
uses: actions/checkout@v5
66+
uses: actions/checkout@v6
6767
with:
6868
fetch-depth: 1
6969
ref: bot
@@ -82,8 +82,9 @@ jobs:
8282
run: |
8383
model="${{ matrix.model }}"
8484
product="${{ matrix.product }}"
85-
ota_link="${{ matrix.ota_link }}"
85+
# ota_link="${{ matrix.ota_link }}"
8686
87+
##############################################################################################################################
8788
# Download avbtool
8889
# curl -Ls https://android.googlesource.com/platform/external/avb/+/master/avbtool.py?format=TEXT | base64 -d > avbtool.py
8990
@@ -97,9 +98,34 @@ jobs:
9798
# DIGEST=$(avbtool calculate_vbmeta_digest --image vbmeta.img)
9899
99100
# 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)
101+
# payload_dumper --metadata --out . "$ota_link"
102+
# FINGERPRINT=$(grep -am1 'post-build=' metadata | cut -d= -f2)
103+
# SECURITY_PATCH=$(grep -am1 'security-patch-level=' metadata | cut -d= -f2)
104+
##############################################################################################################################
105+
106+
download() { wget -T 20 --no-check-certificate "$1" -O "$2"; }
107+
108+
# Get fingerprint detail
109+
download https://developer.android.com/topic/generic-system-image/releases PIXEL_GSI_HTML
110+
RELEASE="$(grep -m1 'corresponding Google Pixel builds' PIXEL_GSI_HTML | grep -o '/versions/.*' | cut -d/ -f3)"
111+
ID="$(grep -m1 -o 'Build:.*' PIXEL_GSI_HTML | cut -d' ' -f2)"
112+
INCREMENTAL="$(grep -m1 -o "$ID-.*-" PIXEL_GSI_HTML | cut -d- -f2)"
113+
114+
# Get security patch
115+
download https://source.android.com/docs/security/bulletin/pixel PIXEL_SECBULL_HTML
116+
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;')"
117+
118+
DEVICE=$(echo "$PRODUCT" | sed 's/_beta//')
119+
FINGERPRINT="google/$PRODUCT/$DEVICE:$RELEASE/$ID/$INCREMENTAL:user/release-keys"
120+
121+
# Validate required fields
122+
required="MODEL PRODUCT DEVICE RELEASE ID INCREMENTAL SECURITY_PATCH"
123+
for i in $required; do
124+
if [ -z "${!i}" ]; then
125+
echo "Missing $i"
126+
exit 1
127+
fi
128+
done
103129
104130
cat <<EOF > ../${product}.prop
105131
FINGERPRINT=$FINGERPRINT
@@ -120,7 +146,7 @@ jobs:
120146
runs-on: ubuntu-latest
121147
steps:
122148
- name: Checkout repository
123-
uses: actions/checkout@v5
149+
uses: actions/checkout@v6
124150
with:
125151
fetch-depth: 1
126152
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"

0 commit comments

Comments
 (0)