Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 8ba5983

Browse files
committed
Account for major versions breaking release page
1 parent 4fbf97c commit 8ba5983

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

get-version.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#!/usr/bin/env bash
22

3-
APP_VERSION=$(curl -sL https://www.tp-link.com/uk/support/download/omada-software-controller/v4/ \
3+
APP_VERSION=$(curl -sL https://www.tp-link.com/uk/support/download/omada-software-controller/ \
44
| grep -E -m 1 -io 'https?://[^ ]+.tar.gz' \
55
| awk -F "/" '{print $NF}' \
66
| awk -F '_' '{print $4}');
7-
7+
8+
if [[ -z "$APP_VERSION" ]]; then
9+
PREVIOUS_MAJOR_VER=$(curl -sL "https://www.tp-link.com/uk/support/download/omada-software-controller" | grep -E -io 'https://www.tp-link.com/uk/support/download/omada-software-controller/\S{2}' | awk -F '/' '{print $8}' | awk 'NR==2{print $1}')
10+
11+
APP_VERSION=$(curl -sL "https://www.tp-link.com/uk/support/download/omada-software-controller/${PREVIOUS_MAJOR_VER}" \
12+
| grep -E -m 1 -io 'https?://[^ ]+.tar.gz' \
13+
| awk -F "/" '{print $NF}' \
14+
| awk -F '_' '{print $4}');
15+
fi
16+
817
printf "%s" "${APP_VERSION}"

0 commit comments

Comments
 (0)