@@ -12,7 +12,23 @@ trap 'rm -f "$TMP_FILE"' EXIT INT TERM
1212
1313echo " ✨ Downloading $DOWNLOAD_URL "
1414
15- if command -v wget > /dev/null 2>&1 ; then
15+ if command -v curl > /dev/null 2>&1 ; then
16+ HTTP_STATUS=$( curl -L# --retry 3 --retry-delay 2 -w " %{http_code}" -o " $TMP_FILE " " $DOWNLOAD_URL " )
17+ CURL_RET=$?
18+ if [ $CURL_RET -ne 0 ]; then
19+ echo " ❌ Error: Curl command failed (Exit Code: $CURL_RET )"
20+ exit 1
21+ fi
22+ if [ " $HTTP_STATUS " != " 200" ]; then
23+ if [ -s " $TMP_FILE " ]; then
24+ SERVER_MSG=$( cat " $TMP_FILE " )
25+ echo " ❌ Error: $SERVER_MSG (Platform: $PLATFORM , Arch: $ARCH , HTTP Status: $HTTP_STATUS )"
26+ else
27+ echo " ❌ Error: Network request failed (Platform: $PLATFORM , Arch: $ARCH , HTTP Status: $HTTP_STATUS )"
28+ fi
29+ exit 1
30+ fi
31+ elif command -v wget > /dev/null 2>&1 ; then
1632 wget -q --show-progress --content-on-error -O " $TMP_FILE " " $DOWNLOAD_URL "
1733 WGET_STATUS=$?
1834 if [ $WGET_STATUS -ne 0 ]; then
@@ -24,16 +40,6 @@ if command -v wget >/dev/null 2>&1; then
2440 fi
2541 exit 1
2642 fi
27- elif command -v curl > /dev/null 2>&1 ; then
28- HTTP_STATUS=$( curl -# -L -w " %{http_code}" -o " $TMP_FILE " " $DOWNLOAD_URL " || echo " CURL_ERROR" )
29- if [ " $HTTP_STATUS " = " CURL_ERROR" ]; then
30- echo " ❌ Error: Network request failed (Platform: $PLATFORM , Arch: $ARCH )"
31- exit 1
32- elif [ " $HTTP_STATUS " != " 200" ]; then
33- SERVER_MSG=$( cat " $TMP_FILE " )
34- echo " ❌ Error: $SERVER_MSG (Platform: $PLATFORM , Arch: $ARCH , HTTP Status: $HTTP_STATUS )"
35- exit 1
36- fi
3743else
3844 echo " ❌ Error: Neither 'curl' nor 'wget' is installed"
3945 echo " 🔔 Please install curl or wget first, then run this script again"
0 commit comments