diff --git a/windows/tools/fxc-wine.sh b/windows/tools/fxc-wine.sh index 239967b..5c8db83 100755 --- a/windows/tools/fxc-wine.sh +++ b/windows/tools/fxc-wine.sh @@ -16,6 +16,7 @@ FXC_IN_CAB=fil6dfaf6bbf56939fbab75b569ffa0fd41 DLL_IN_CAB=fil0d3f984977487cd87127d614f654195b here=$(dirname "$(realpath "$0")") +. "$here/lib.sh" pkg() { nix build --no-link --print-out-paths --inputs-from "$here/.." "nixpkgs#$1" | head -1; } verified() { [ -f "$CACHE/fxc.exe" ] && [ -f "$CACHE/d3dcompiler_47.dll" ] && @@ -26,8 +27,8 @@ verified() { if ! verified; then mkdir -p "$CACHE" tmp=$(mktemp -d) - curl -sSfL -o "$tmp/tools.cab" "$CAB_URL" - echo "$CAB_SHA256 $tmp/tools.cab" | sha256sum -c --quiet + # Retried, and in pieces if the line stalls (a reset failed a release build once). + fetch_pinned "$CAB_URL" "$CAB_SHA256" "$tmp/tools.cab" >&2 (cd "$tmp" && "$(pkg gcab.bin)/bin/gcab" -x tools.cab "$FXC_IN_CAB" "$DLL_IN_CAB") mv "$tmp/$FXC_IN_CAB" "$CACHE/fxc.exe" mv "$tmp/$DLL_IN_CAB" "$CACHE/d3dcompiler_47.dll" diff --git a/windows/tools/lib.sh b/windows/tools/lib.sh index d0787c4..8e52822 100644 --- a/windows/tools/lib.sh +++ b/windows/tools/lib.sh @@ -66,7 +66,7 @@ fetch_pinned() { fi # Whole, unless it stalls: some networks cut TLS to some hosts after about 16 KB (as # zapret2's cutoff option knows). Then in ranges below that, each on a connection of its own. - if ! curl -fsSL --connect-timeout 30 --speed-limit 1 --speed-time 15 --max-time 900 --retry 2 -o "$out" "$url"; then + if ! curl -fsSL --connect-timeout 30 --speed-limit 1 --speed-time 15 --max-time 900 --retry 3 --retry-all-errors -o "$out" "$url"; then echo "$url stalled; fetching it in pieces" >&2 local size from=0 step=12000 tries=0 size=$(curl -fsSIL --connect-timeout 30 --max-time 60 "$url" | tr -d '\r' | awk 'tolower($1) == "content-length:" { n = $2 } END { print n }')