summaryrefslogtreecommitdiffhomepage
path: root/install
diff options
context:
space:
mode:
authorDavid Hill <[email protected]>2025-12-16 10:54:51 +0000
committerDavid Hill <[email protected]>2025-12-16 10:54:51 +0000
commit05e0759878cb0f24c981c69ae26f6be3ea5583c6 (patch)
tree39aaf6b86a6f2b8e653120e80d8f0facb528051b /install
parent2330ec6dc3000ae8b86810e9d59b414ad4f05f47 (diff)
parent75e5130cf8f58b32ee3f3ba2249d5917e7e3d6fc (diff)
downloadopencode-05e0759878cb0f24c981c69ae26f6be3ea5583c6.tar.gz
opencode-05e0759878cb0f24c981c69ae26f6be3ea5583c6.zip
Merge branch 'dev' of https://github.com/sst/opencode into dev
Diffstat (limited to 'install')
-rwxr-xr-xinstall17
1 files changed, 9 insertions, 8 deletions
diff --git a/install b/install
index c6f209734..67690b9a3 100755
--- a/install
+++ b/install
@@ -240,22 +240,23 @@ download_with_progress() {
download_and_install() {
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
- mkdir -p opencodetmp && cd opencodetmp
+ local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
+ mkdir -p "$tmp_dir"
- if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$filename"; then
- # Fallback to standard curl on Windows or if custom progress fails
- curl -# -L -o "$filename" "$url"
+ if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
+ # Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails
+ curl -# -L -o "$tmp_dir/$filename" "$url"
fi
if [ "$os" = "linux" ]; then
- tar -xzf "$filename"
+ tar -xzf "$tmp_dir/$filename" -C "$tmp_dir"
else
- unzip -q "$filename"
+ unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
fi
- mv opencode "$INSTALL_DIR"
+ mv "$tmp_dir/opencode" "$INSTALL_DIR"
chmod 755 "${INSTALL_DIR}/opencode"
- cd .. && rm -rf opencodetmp
+ rm -rf "$tmp_dir"
}
check_version