From 1493650b650e60453176f4d36a49844c6be96aa7 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 21 Feb 2025 23:16:09 -0400 Subject: [PATCH] autopif2.sh: promote --preview and --depth to documented features -p or --preview forces not to ignore Android Platform Preview builds (Developer Previews and Betas) -d # or --depth # chooses the depth to crawl down the QPR Betas list when there are multiple active Betas, e.g. when QPR2 was concurrent with QPR1 the default value of 1 would get the first listed (QPR2) and -d 2 would force it to get the second listed (QPR1) --- module/autopif2.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/module/autopif2.sh b/module/autopif2.sh index 95b5c81..35aab43 100644 --- a/module/autopif2.sh +++ b/module/autopif2.sh @@ -7,11 +7,17 @@ case "$HOME" in *termux*) echo "autopif2: need su root environment"; exit 1;; esac; -case "$1" in - -h|--help|help) echo "sh autopif2.sh [-a|-s]"; exit 0;; - -a|--advanced|advanced) ARGS="-a"; shift;; - -s|--strong|strong) ARGS="-a"; PATCH_COMMENT=1; spoofProvider=0; shift;; -esac; +FORCE_DEPTH=1; +until [ -z "$1" ]; do + case "$1" in + -h|--help|help) echo "sh autopif2.sh [-a|-s] [-p] [-d #]"; exit 0;; + -a|--advanced|advanced) ARGS="-a"; shift;; + -s|--strong|strong) ARGS="-a"; PATCH_COMMENT=1; spoofProvider=0; shift;; + -p|--preview|preview) FORCE_PREVIEW=1; shift;; + -d|--depth|depth) FORCE_DEPTH=$2; shift 2;; + *) break;; + esac; +done; echo "Pixel Beta pif.json generator script \ \n by osm0sis @ xda-developers"; @@ -72,14 +78,12 @@ 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; -case "$1" in -p) FORCE_PREVIEW=1; shift;; esac; 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; -case "$1" in -d) FORCE_DEPTH=$2; shift 2;; *) FORCE_DEPTH=1;; esac; 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)";