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

Commit 4e4de45

Browse files
authored
Merge pull request #10 from linuxserver-labs/download-fix
2 parents fd78710 + 44c7c23 commit 4e4de45

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Dockerfile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,41 @@ ARG DEBIAN_FRONTEND="noninteractive"
1313
RUN \
1414
echo "**** install packages ****" && \
1515
apt-get update && \
16-
apt-get install -y \
16+
apt-get install --no-install-recommends -y \
1717
bash \
1818
curl \
1919
jsvc \
2020
libcap2 \
2121
logrotate \
2222
mongodb-server \
2323
openjdk-8-jre-headless && \
24-
echo "**** install omada ****" && \
24+
echo "**** download omada ****" && \
2525
# Somehow figure out version detection and download URL here
2626
if [ -z ${APP_VERSION+x} ]; then \
27+
echo "**** No APP_VERSION supplied, detecting ****" && \
2728
APP_VERSION=$(curl -sL https://www.tp-link.com/uk/support/download/omada-software-controller/ \
2829
| grep -E -m 1 -io 'https?://[^ ]+.tar.gz' \
2930
| awk -F "/" '{print $NF}' \
3031
| awk -F '_' '{print $4}'); \
3132
fi && \
33+
if [ -z ${APP_VERSION} ]; then \
34+
echo "**** No current version found, trying previous major versions ****" && \
35+
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}') && \
36+
echo "**** Previous major version was $PREVIOUS_MAJOR_VER ****" && \
37+
APP_VERSION=$(curl -sL "https://www.tp-link.com/uk/support/download/omada-software-controller/${PREVIOUS_MAJOR_VER}" \
38+
| grep -E -m 1 -io 'https?://[^ ]+.tar.gz' \
39+
| awk -F "/" '{print $NF}' \
40+
| awk -F '_' '{print $4}'); \
41+
fi && \
42+
echo "**** App version is ${APP_VERSION} ****" && \
3243
mkdir -p /tmp/omada && \
33-
OMADA_DOWNLOAD=$(curl -sL https://www.tp-link.com/uk/support/download/omada-software-controller/ \
44+
OMADA_DOWNLOAD=$(curl -sL "https://www.tp-link.com/uk/support/download/omada-software-controller/$(echo $APP_VERSION | cut -c 1-2)" \
3445
| grep -E -io "https?://[^ ]+${APP_VERSION}_linux_x64.tar.gz") && \
3546
# Download Omada package, try and handle their appalling packaging "standards"
3647
curl -o \
3748
/tmp/omada.tar.gz -L \
3849
${OMADA_DOWNLOAD} && \
50+
echo "**** unpack omada ****" && \
3951
if [ $(tar -tf /tmp/omada.tar.gz | awk -F "\n" '{print $1;exit}' | grep -i "omada") ]; then \
4052
tar xf \
4153
/tmp/omada.tar.gz -C \
@@ -45,6 +57,7 @@ RUN \
4557
/tmp/omada.tar.gz -C \
4658
/tmp/omada/; \
4759
fi && \
60+
echo "**** install omada ****" && \
4861
mkdir -p /app/omada && \
4962
cd /tmp/omada && \
5063
for name in bin data properties webapps keystore lib install.sh uninstall.sh; do cp ${name} /app/omada -r; done && \

0 commit comments

Comments
 (0)