Skip to content

fix: implement install-dir override chain in the installer - #44079

Open
SomSamantray wants to merge 1 commit into
anomalyco:devfrom
SomSamantray:fix/install-dir-override-chain
Open

fix: implement install-dir override chain in the installer#44079
SomSamantray wants to merge 1 commit into
anomalyco:devfrom
SomSamantray:fix/install-dir-override-chain

Conversation

@SomSamantray

Copy link
Copy Markdown

Issue for this PR

Closes #43772

Related: #42974 (duplicate report of the same root cause)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

README.md documents a four-level priority chain for the install directory ($OPENCODE_INSTALL_DIR -> $XDG_BIN_DIR -> $HOME/bin -> $HOME/.opencode/bin), but the install script ignored both env vars and always installed to $HOME/.opencode/bin. This implements the chain exactly as documented: check $OPENCODE_INSTALL_DIR, then $XDG_BIN_DIR, then try creating $HOME/bin, and only fall back to $HOME/.opencode/bin when none of those apply. No other install-script behavior changes.

How did you verify your code works?

No test harness exists for the install shell script in this repo, so I exercised the modified block in isolation with env -i to control HOME/env vars per case:

  • $OPENCODE_INSTALL_DIR set alone -> used
  • $XDG_BIN_DIR set alone -> used
  • both set -> $OPENCODE_INSTALL_DIR wins
  • neither set, $HOME/bin missing but creatable -> created and used
  • neither set, $HOME/bin already exists -> used
  • neither set, $HOME/bin uncreatable (read-only $HOME) -> falls back to $HOME/.opencode/bin
  • $OPENCODE_INSTALL_DIR exported empty -> treated as unset, falls through

All 8 checks passed. Also ran bash -n install (syntax check) and confirmed git diff touches only the INSTALL_DIR resolution block (lines 68-69 originally).

Screenshots / recordings

N/A — shell script change, no UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

OPENCODE_INSTALL_DIR > XDG_BIN_DIR > $HOME/bin > $HOME/.opencode/bin,
matching README.md's Installation Directory section. The install
script previously hardcoded $HOME/.opencode/bin and ignored both
env vars entirely.

Closes anomalyco#43772
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

This PR appears to address the same issue—implementing the install directory override chain for OPENCODE_INSTALL_DIR and XDG_BIN_DIR. Since the current PR is #44079 and #42975 already exists with nearly identical scope, you should check whether #42975 is still open or if there's been progress that makes the current PR redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README documents an install-dir override chain (OPENCODE_INSTALL_DIR / XDG_BIN_DIR) that the installer does not implement

1 participant