summaryrefslogtreecommitdiffhomepage
path: root/install
diff options
context:
space:
mode:
authorLucas Duailibe <[email protected]>2025-12-15 22:58:07 -0300
committerGitHub <[email protected]>2025-12-15 19:58:07 -0600
commit0dc62d5dadb75266d1630fc85d0e95a309097f15 (patch)
tree73e3b20f08d0fcbcc6a5e806d2a789ee31bd37a1 /install
parentd118782a10d389dcc67835e5af756186270be206 (diff)
downloadopencode-0dc62d5dadb75266d1630fc85d0e95a309097f15.tar.gz
opencode-0dc62d5dadb75266d1630fc85d0e95a309097f15.zip
make install script use tmp dir (#5601)
Diffstat (limited to 'install')
-rwxr-xr-xinstall15
1 files changed, 8 insertions, 7 deletions
diff --git a/install b/install
index c6f209734..115ac169a 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
+ if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
# Fallback to standard curl on Windows or if custom progress fails
- curl -# -L -o "$filename" "$url"
+ 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