From 3c9c13e3ffb7e50859d0660c55cffc905fe1b6d4 Mon Sep 17 00:00:00 2001 From: Chris Renshaw Date: Wed, 20 Aug 2025 22:05:40 -0300 Subject: [PATCH] autopif2: RIP Preview program, hello top level version arg -p or --preview has been removed since the Platform Preview program has been replaced by Android Canary -t # or --top # chooses the top level version depth to crawl down the Android version list for when there are multiple active Betas in multiple Android versions, e.g. with 16 as latest the default value of 1 would get its listed QPRs and -t 2 would force it to get the second listed (15) --- module/action.sh | 2 +- module/autopif2.sh | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/module/action.sh b/module/action.sh index 25ce22e..a111caf 100644 --- a/module/action.sh +++ b/module/action.sh @@ -4,7 +4,7 @@ MODPATH="${0%/*}" set +o standalone unset ASH_STANDALONE -sh $MODPATH/autopif2.sh -s -m -p || exit 1 +sh $MODPATH/autopif2.sh -s -m || exit 1 echo -e "\nDone!" diff --git a/module/autopif2.sh b/module/autopif2.sh index 15e5346..da9b760 100644 --- a/module/autopif2.sh +++ b/module/autopif2.sh @@ -7,14 +7,15 @@ case "$HOME" in *termux*) echo "autopif2: need su root environment"; exit 1;; esac; +FORCE_TOP=1; FORCE_DEPTH=1; until [ -z "$1" ]; do case "$1" in - -h|--help|help) echo "sh autopif2.sh [-a|-s] [-m] [-p] [-d #]"; exit 0;; + -h|--help|help) echo "sh autopif2.sh [-a|-s] [-m] [-t #] [-d #]"; exit 0;; -a|--advanced|advanced) ARGS="-a"; shift;; -s|--strong|strong) ARGS="-a"; PATCH_COMMENT=1; spoofProvider=0; shift;; -m|--match|match) FORCE_MATCH=1; shift;; - -p|--preview|preview) FORCE_PREVIEW=1; shift;; + -t|--top|top) echo "$2" | grep -q '^[1-9]$' || exit 1; FORCE_TOP=$2; shift 2;; -d|--depth|depth) echo "$2" | grep -q '^[1-9]$' || exit 1; FORCE_DEPTH=$2; shift 2;; *) break;; esac; @@ -80,15 +81,9 @@ cd "$DIR"; item "Crawling Android Developers for latest Pixel Beta ..."; wget -q -O PIXEL_VERSIONS_HTML --no-check-certificate https://developer.android.com/about/versions 2>&1 || exit 1; -wget -q -O PIXEL_LATEST_HTML --no-check-certificate $(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n1) 2>&1 || exit 1; -if grep -qE 'Developer Preview|tooltip>.*preview program' PIXEL_LATEST_HTML && [ ! "$FORCE_PREVIEW" ]; then - wget -q -O PIXEL_BETA_HTML --no-check-certificate $(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n2 | tail -n1) 2>&1 || exit 1; -else - TITLE="Preview "; - mv -f PIXEL_LATEST_HTML PIXEL_BETA_HTML; -fi; -wget -q -O PIXEL_OTA_HTML --no-check-certificate https://developer.android.com$(grep -o 'href=".*download-ota.*"' PIXEL_BETA_HTML | cut -d\" -f2 | head -n$FORCE_DEPTH | tail -n1) 2>&1 || exit 1; -echo "$(grep -m1 -oE 'tooltip>Android .*[0-9]' PIXEL_OTA_HTML | cut -d\> -f2) $TITLE$(grep -oE 'tooltip>QPR.* Beta' PIXEL_OTA_HTML | cut -d\> -f2 | head -n$FORCE_DEPTH | tail -n1)"; +wget -q -O PIXEL_LATEST_HTML --no-check-certificate $(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n$FORCE_TOP | tail -n1) 2>&1 || exit 1; +wget -q -O PIXEL_OTA_HTML --no-check-certificate https://developer.android.com$(grep -o 'href=".*download-ota.*"' PIXEL_LATEST_HTML | grep 'qpr' | cut -d\" -f2 | head -n$FORCE_DEPTH | tail -n1) 2>&1 || exit 1; +echo "$(grep -m1 -oE 'tooltip>Android .*[0-9]' PIXEL_OTA_HTML | cut -d\> -f2) $(grep -oE 'tooltip>QPR.* Beta' PIXEL_OTA_HTML | cut -d\> -f2 | head -n$FORCE_DEPTH | tail -n1)"; BETA_REL_DATE="$(date -D '%B %e, %Y' -d "$(grep -m1 -A1 'Release date' PIXEL_OTA_HTML | tail -n1 | sed 's;.*\(.*\).*;\1;')" '+%Y-%m-%d')"; BETA_EXP_DATE="$(date -D '%s' -d "$(($(date -D '%Y-%m-%d' -d "$BETA_REL_DATE" '+%s') + 60 * 60 * 24 * 7 * 6))" '+%Y-%m-%d')";