summaryrefslogtreecommitdiffhomepage
path: root/install
diff options
context:
space:
mode:
authoropencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>2025-07-18 14:15:10 -0400
committerGitHub <[email protected]>2025-07-18 14:15:10 -0400
commit01e7dc2d02e931be8dda945d44971c178a1a6a15 (patch)
tree8db3468e9a4cea79b2b16ced6af2e0d42dea59f3 /install
parent611854e4b68a2bfa30b336c1fa5135765c593f0f (diff)
downloadopencode-01e7dc2d02e931be8dda945d44971c178a1a6a15.tar.gz
opencode-01e7dc2d02e931be8dda945d44971c178a1a6a15.zip
Added install dir priority & user feedback (#1129)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: thdxr <[email protected]>
Diffstat (limited to 'install')
-rwxr-xr-xinstall14
1 files changed, 13 insertions, 1 deletions
diff --git a/install b/install
index 2a48cc1f4..29e77c139 100755
--- a/install
+++ b/install
@@ -41,9 +41,21 @@ case "$filename" in
;;
esac
-INSTALL_DIR=$HOME/.opencode/bin
+# Determine installation directory with priority order
+if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then
+ INSTALL_DIR="$OPENCODE_INSTALL_DIR"
+elif [ -n "${XDG_BIN_DIR:-}" ]; then
+ INSTALL_DIR="$XDG_BIN_DIR"
+elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then
+ INSTALL_DIR="$HOME/bin"
+else
+ INSTALL_DIR="$HOME/.opencode/bin"
+fi
+
mkdir -p "$INSTALL_DIR"
+print_message info "Installing to: ${YELLOW}$INSTALL_DIR${GREEN}"
+
if [ -z "$requested_version" ]; then
url="https://github.com/sst/opencode/releases/latest/download/$filename"
specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}')