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

Commit fd78710

Browse files
authored
Merge pull request #9 from linuxserver-labs/major-ver-check
2 parents 4fbf97c + bea477a commit fd78710

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

get-version.sh

Lines changed: 12 additions & 3 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-
8-
printf "%s" "${APP_VERSION}"
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+
17+
printf "%s" "${APP_VERSION}"

0 commit comments

Comments
 (0)