Issues with downloading new server version - suggested fix (#126)

* Sort existing server versions reverse numerically

* Display restify's stderr on failed download with existing servers

* Add retries

Fixes #123
This commit is contained in:
Tom Abnett authored and GitHub committed 2021-01-04 15:44:45 -06:00
1 parent b153f22458
commit 2cabd4f2ee
1 file changed
+8 -5
+8 -5
View File
@@ -40,16 +40,19 @@ case ${VERSION^^} in
;; ;;
LATEST) LATEST)
for a in data-bi-prtid data-platform; do for a in data-bi-prtid data-platform; do
DOWNLOAD_URL=$(restify --attribute=${a}=serverBedrockLinux ${downloadPage} 2> restify.err | jq -r '.[0].href' || echo '') for i in {1..3}; do
if [[ ${DOWNLOAD_URL} ]]; then DOWNLOAD_URL=$(restify --attribute=${a}=serverBedrockLinux ${downloadPage} 2> restify.err | jq -r '.[0].href' || echo '')
break if [[ ${DOWNLOAD_URL} ]]; then
fi break 2
fi
done
done done
if [[ ${DOWNLOAD_URL} =~ http.*/.*-(.*)\.zip ]]; then if [[ ${DOWNLOAD_URL} =~ http.*/.*-(.*)\.zip ]]; then
VERSION=${BASH_REMATCH[1]} VERSION=${BASH_REMATCH[1]}
elif [[ $(ls bedrock_server-* 2> /dev/null|head -1) =~ bedrock_server-(.*) ]]; then elif [[ $(ls -rv bedrock_server-* 2> /dev/null|head -1) =~ bedrock_server-(.*) ]]; then
VERSION=${BASH_REMATCH[1]} VERSION=${BASH_REMATCH[1]}
echo "WARN Minecraft download page failed, so using existing download of $VERSION" echo "WARN Minecraft download page failed, so using existing download of $VERSION"
cat restify.err
else else
echo "Failed to extract download URL '${DOWNLOAD_URL}' from ${downloadPage}" echo "Failed to extract download URL '${DOWNLOAD_URL}' from ${downloadPage}"
cat restify.err cat restify.err