Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 0dc62d5

Browse files
authored
make install script use tmp dir (anomalyco#5601)
1 parent d118782 commit 0dc62d5

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

install

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,22 +240,23 @@ download_with_progress() {
240240

241241
download_and_install() {
242242
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
243-
mkdir -p opencodetmp && cd opencodetmp
243+
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
244+
mkdir -p "$tmp_dir"
244245

245-
if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$filename"; then
246+
if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
246247
# Fallback to standard curl on Windows or if custom progress fails
247-
curl -# -L -o "$filename" "$url"
248+
curl -# -L -o "$tmp_dir/$filename" "$url"
248249
fi
249250

250251
if [ "$os" = "linux" ]; then
251-
tar -xzf "$filename"
252+
tar -xzf "$tmp_dir/$filename" -C "$tmp_dir"
252253
else
253-
unzip -q "$filename"
254+
unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
254255
fi
255256

256-
mv opencode "$INSTALL_DIR"
257+
mv "$tmp_dir/opencode" "$INSTALL_DIR"
257258
chmod 755 "${INSTALL_DIR}/opencode"
258-
cd .. && rm -rf opencodetmp
259+
rm -rf "$tmp_dir"
259260
}
260261

261262
check_version

0 commit comments

Comments
 (0)