Skip to content

Commit b2d8a4c

Browse files
1995parhamclaude
andcommitted
feat(lib/github): OFFLINE=1 short-circuits require_github_release
Hosts that cannot reach github.com (e.g. an Iran-only egress) cannot fetch binary releases. Previously this caused any script depending on `require_github_release` (currently fetch.sh, alacritty.sh, several others) to fail the entire start.sh run with a 5-minute curl timeout. When OFFLINE=1 is set in the environment, the function now logs a skip and returns 0, treating the dependency as satisfied (best-effort). Callers that NEED the github binary still fail at runtime when the binary is invoked, but the install script itself no longer aborts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cdd4b33 commit b2d8a4c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/lib/github.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ require_github_release() {
266266
local release_name=${3:?'release name is required (e.g., clash-aarch64-apple-darwin)'}
267267
local archive_ext=${4:-""}
268268

269+
# Airgapped escape hatch: when OFFLINE=1 is set, hosts that cannot
270+
# reach github.com (e.g. an Iran-only egress) can still run scripts
271+
# that depend on require_github_release. We log a skip and return 0
272+
# so the calling script's framework treats the dependency as
273+
# "satisfied (best-effort)" rather than failing the run.
274+
if [[ "${OFFLINE:-0}" == "1" ]]; then
275+
running "require" " github-release ${repo} ${binary_name} (skipped: OFFLINE=1)"
276+
return 0
277+
fi
278+
269279
local install_dir="${HOME}/.local/bin"
270280
mkdir -p "${install_dir}"
271281

0 commit comments

Comments
 (0)