diff --git a/Readme.adoc b/Readme.adoc index 7690ebc..1faee27 100644 --- a/Readme.adoc +++ b/Readme.adoc @@ -58,8 +58,8 @@ bundles `lc` with the wrapper scripts (`lcreate`, `lcls`, `lclose`, [source,sh] ---- -$ curl -sLO https://github.com/rubyists/linear-cli/releases/latest/download/lc_macos_aarch64.tar.gz -$ curl -sLo SHA256SUMS https://github.com/rubyists/linear-cli/releases/latest/download/SHA256SUMS +$ curl --retry 5 --retry-all-errors -sLO https://github.com/rubyists/linear-cli/releases/latest/download/lc_macos_aarch64.tar.gz +$ curl --retry 5 --retry-all-errors -sLo SHA256SUMS https://github.com/rubyists/linear-cli/releases/latest/download/SHA256SUMS $ grep -q lc_macos_aarch64.tar.gz SHA256SUMS && grep lc_macos_aarch64.tar.gz SHA256SUMS | shasum -a 256 -c - <1> $ mkdir lc && tar -xzf lc_macos_aarch64.tar.gz -C lc $ sudo mv lc/* /usr/local/bin/ @@ -94,7 +94,7 @@ See https://github.com/rubyists/homebrew-tap for the formula itself. [source,sh] ---- -$ curl -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/install.sh | bash +$ curl --retry 5 --retry-all-errors -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/install.sh | bash ---- Detects your platform, downloads and checksum-verifies the matching release @@ -106,7 +106,7 @@ specific install directory. [source,sh] ---- -$ curl -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/uninstall.sh | bash +$ curl --retry 5 --retry-all-errors -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/uninstall.sh | bash ---- Removes exactly what `install.sh` installed, by replaying the manifest it diff --git a/install.sh b/install.sh index 0f4457a..cec9d5d 100755 --- a/install.sh +++ b/install.sh @@ -110,13 +110,19 @@ fetch_lc() { printf 'Downloading %s (%s)...\n' "$tarball" "$version" >&2 - if ! curl -fsSL "$(release_url "$tarball")" -o "$tmp_dir/$tarball" + # --retry-all-errors: GitHub's release-download redirect chain + # occasionally drops the connection outright mid-stream (curl: (56) + # Connection died) - verified directly, reproduced it repeatedly, and + # confirmed plain --retry alone does NOT cover this specific error + # (it's outside curl's default retriable set), only succeeding once + # --retry-all-errors was added too. + if ! curl -fsSL --retry 5 --retry-all-errors "$(release_url "$tarball")" -o "$tmp_dir/$tarball" then printf 'error: failed to download %s\n' "$tarball" >&2 exit 1 fi - if ! curl -fsSL "$(release_url "SHA256SUMS")" -o "$tmp_dir/SHA256SUMS" + if ! curl -fsSL --retry 5 --retry-all-errors "$(release_url "SHA256SUMS")" -o "$tmp_dir/SHA256SUMS" then printf 'error: failed to download SHA256SUMS\n' >&2 exit 1