GeezerVison is showing github.com — make install script use tmp dir (#5601) · dkarzon/opencode@0dc62d5
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: install +8-7Lines changed: 8 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -240,22 +240,23 @@ download_with_progress() { |
240 | 240 |
|
241 | 241 | download_and_install() { |
242 | 242 | 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" |
244 | 245 |
|
245 | | - if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$filename"; then |
| 246 | + if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$tmp_dir/$filename"; then |
246 | 247 | # 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" |
248 | 249 | fi |
249 | 250 |
|
250 | 251 | if [ "$os" = "linux" ]; then |
251 | | - tar -xzf "$filename" |
| 252 | + tar -xzf "$tmp_dir/$filename" -C "$tmp_dir" |
252 | 253 | else |
253 | | - unzip -q "$filename" |
| 254 | + unzip -q "$tmp_dir/$filename" -d "$tmp_dir" |
254 | 255 | fi |
255 | 256 |
|
256 | | - mv opencode "$INSTALL_DIR" |
| 257 | + mv "$tmp_dir/opencode" "$INSTALL_DIR" |
257 | 258 | chmod 755 "${INSTALL_DIR}/opencode" |
258 | | - cd .. && rm -rf opencodetmp |
| 259 | + rm -rf "$tmp_dir" |
259 | 260 | } |
260 | 261 |
|
261 | 262 | check_version |
|