File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -42,27 +42,35 @@ case ${VERSION^^} in
42
42
LATEST)
43
43
echo " Looking up latest version..."
44
44
for a in data-platform ; do
45
- for i in {1..5 }; do
45
+ for i in {1..3 }; do
46
46
DOWNLOAD_URL=$( restify --user-agent=itzg/minecraft-bedrock-server --headers " accept-language:*" --attribute=${a} =serverBedrockLinux ${downloadPage} 2> restify.err | jq -r ' .[0].href' || echo ' ' )
47
47
if [[ ${DOWNLOAD_URL} ]]; then
48
48
break 2
49
49
fi
50
50
sleep 1
51
51
done
52
52
done
53
+ if [[ -z ${DOWNLOAD_URL} ]]; then
54
+ DOWNLOAD_URL=$( curl -s https://mc-bds-helper.vercel.app/api/latest)
55
+ fi
56
+
53
57
if [[ ${DOWNLOAD_URL} =~ http.* /.* -(.* )\. zip ]]; then
54
58
VERSION=${BASH_REMATCH[1]}
55
59
elif [[ $( ls -rv bedrock_server-* 2> /dev/null| head -1) =~ bedrock_server-(.* ) ]]; then
56
60
VERSION=${BASH_REMATCH[1]}
57
61
echo " WARN Minecraft download page failed, so using existing download of $VERSION "
58
62
cat restify.err
59
63
else
60
- echo " Failed to extract download URL '${DOWNLOAD_URL} ' from ${downloadPage} "
61
- cat restify.err
62
- rm restify.err
64
+ if [[ -f restify.err ]]; then
65
+ echo " Failed to extract download URL '${DOWNLOAD_URL} ' from ${downloadPage} "
66
+ cat restify.err
67
+ rm restify.err
68
+ else
69
+ echo " Failed to lookup download URL: ${DOWNLOAD_URL} "
70
+ fi
63
71
exit 2
64
72
fi
65
- rm restify.err
73
+ rm -f restify.err
66
74
;;
67
75
* )
68
76
# use the given version exactly
You can’t perform that action at this time.
0 commit comments