diff --git a/home/stormux/.local/.functions/download.sh b/home/stormux/.local/.functions/download.sh index 161c2c0..4be3136 100755 --- a/home/stormux/.local/.functions/download.sh +++ b/home/stormux/.local/.functions/download.sh @@ -29,36 +29,40 @@ download_with_fallback() { totalBytes="$(get_remote_file_size "${sourceUrl}")" printf 'Trying curl with resume support: %s\n' "${sourceUrl}" >&2 - if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 -C - "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"; then + run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 -C - "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}" + curlExitCode=$? + if [[ "${curlExitCode}" -eq 0 ]]; then rm -f "${errorFile}" return 0 fi - curlExitCode=$? rm -f "${outputPath}" printf 'Trying fresh IPv4 curl download: %s\n' "${sourceUrl}" >&2 - if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"; then + run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}" + retryExitCode=$? + if [[ "${retryExitCode}" -eq 0 ]]; then rm -f "${errorFile}" return 0 fi - retryExitCode=$? rm -f "${outputPath}" printf 'Trying fresh curl download with any address family: %s\n' "${sourceUrl}" >&2 - if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"; then + run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}" + fallbackExitCode=$? + if [[ "${fallbackExitCode}" -eq 0 ]]; then rm -f "${errorFile}" return 0 fi - fallbackExitCode=$? if command -v wget > /dev/null 2>&1; then rm -f "${outputPath}" printf 'Trying wget fallback: %s\n' "${sourceUrl}" >&2 - if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" wget --tries=3 --timeout=20 --read-timeout=30 --output-document="${outputPath}" "${sourceUrl}"; then + run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" wget --tries=3 --timeout=20 --read-timeout=30 --output-document="${outputPath}" "${sourceUrl}" + wgetExitCode=$? + if [[ "${wgetExitCode}" -eq 0 ]]; then rm -f "${errorFile}" return 0 fi - wgetExitCode=$? fi downloadAttemptExitCodes="curl: ${curlExitCode}, ${retryExitCode}, ${fallbackExitCode}" diff --git a/home/stormux/.local/.functions/install_game.sh b/home/stormux/.local/.functions/install_game.sh index f1b9d96..de4ecc2 100755 --- a/home/stormux/.local/.functions/install_game.sh +++ b/home/stormux/.local/.functions/install_game.sh @@ -19,7 +19,7 @@ installPath="${installPath:-${HOME}/.local/games}" cache="${cache:-${XDG_CACHE_HOME:-${HOME}/.cache}/stormux-game-install}" launchRoot="${launchRoot:-${HOME}/.local/.launch}" redownload="${redownload:-false}" -ipfsGateway="${ipfsGateway:-https://gateway.pinata.cloud}" +ipfsGateway="${ipfsGateway:-https://ipfs.stormux.org}" fex="${fex:-}" export installPath cache launchRoot redownload ipfsGateway fex gameName