@@ -404,7 +404,7 @@ downloadLatestReleaseInfo() {
404404
405405 if [ -f " $release_info_file " ]; then
406406 # Only extract and echo the version number, without any additional messages
407- grep -Po ' "tag_name": "prod-app-v\K[\d.]+(?=")' " $release_info_file "
407+ grep -Po ' "tag_name":\s* "prod-app-v\K[\d.]+(?=")' " $release_info_file "
408408 return
409409 fi
410410
@@ -416,7 +416,7 @@ downloadLatestReleaseInfo() {
416416 }
417417
418418 # Only extract and echo the version number after successful download
419- grep -Po ' "tag_name": "prod-app-v\K[\d.]+(?=")' " $release_info_file "
419+ grep -Po ' "tag_name":\s* "prod-app-v\K[\d.]+(?=")' " $release_info_file "
420420}
421421
422422# Download Latest Release Information Function
@@ -475,22 +475,29 @@ downloadAndInstall(){
475475 BEST_MATCH_VERSION=" $BINARY_GLIBC_VERSION "
476476 echo " Found a new best match: $BEST_MATCH_URL with GLIBC version $BEST_MATCH_VERSION "
477477 fi
478- done < <( grep -oP ' "browser_download_url": "\K(. *_linux_bin-GLIBC-[\d\.]+\.tar\.gz) (?=")' " $TMP_DIR /latest_release.json" )
478+ done < <( grep -oP ' "browser_download_url"\s*:\s* "\K[^"] *_linux_bin-GLIBC-[\d\.]+\.tar\.gz(?=")' " $TMP_DIR /latest_release.json" )
479479
480480 if [ -z " $BEST_MATCH_URL " ]; then
481481 echo -e " ${RED} No compatible binary found for the current GLIBC version ($CURRENT_GLIBC_VERSION ). Exiting installation.${RESET} "
482482 exit 1
483483 fi
484484
485485 echo -e " ${YELLOW} Downloading the compatible binary from $BEST_MATCH_URL ...${RESET} "
486- wget -c -N --tries=10 --timeout=30 --waitretry=5 --retry-connrefused --show-progress -qO " $TMP_DIR /phoenix-code.tar.gz" " $BEST_MATCH_URL " || {
486+ # Set options based on wget version
487+ WGET_OPTS=$( configure_wget_options)
488+
489+ # Download the code tarball
490+ echo -e " Downloading the code tarball..."
491+ wget $WGET_OPTS " $TMP_DIR /phoenix-code.tar.gz" " $BEST_MATCH_URL " 2> /dev/null || {
487492 echo -e " ${RED} Failed to download the binary. Please check your internet connection and try again.${RESET} "
488493 exit 1
489494 }
495+
496+ # Download the icon
490497 echo -e " Downloading the icon..."
491- wget -c -N --tries=10 --timeout=30 --waitretry=5 --retry-connrefused --show-progress -qO " $TMP_DIR /icon.png" " $ICON_URL " || {
492- echo -e " ${RED} Failed to download Icon ${RESET} " ;
493- exit 1;
498+ wget $WGET_OPTS " $TMP_DIR /icon.png" " $ICON_URL " 2> /dev/null || {
499+ echo -e " ${RED} Failed to download the icon ${RESET} "
500+ exit 1
494501 }
495502 echo " Extracting the binary to $TMP_DIR ..."
496503 tar -xzf " $TMP_DIR /phoenix-code.tar.gz" -C " $TMP_DIR " || {
@@ -504,6 +511,17 @@ downloadAndInstall(){
504511 exit 1
505512 fi
506513}
514+ # Function to check wget version and configure options
515+ configure_wget_options () {
516+ local wget_version=$( wget --version | head -n1 | awk ' {print $3}' )
517+ local major_version=$( echo " $wget_version " | cut -d. -f1)
518+
519+ if [[ " $major_version " -ge 2 ]]; then
520+ echo " -c -N --tries=10 --timeout=30 --waitretry=5 --progress=bar --retry-connrefused -O"
521+ else
522+ echo " -c -N --tries=10 --timeout=30 --waitretry=5 --retry-connrefused --show-progress -qO"
523+ fi
524+ }
507525# Install Function
508526#
509527# Purpose:
0 commit comments