From 3bee803b518ee2a8d82bf63cb2dacbe98366103d Mon Sep 17 00:00:00 2001 From: Anne Schuth Date: Fri, 8 Aug 2025 07:05:56 +0200 Subject: [PATCH] Use TMPDIR environment variable in install script (#35636) ## Summary This PR updates the install script to respect the `TMPDIR` environment variable when creating temporary directories. ## Motivation Some environments have non-standard temporary directory locations or restrictions on `/tmp`. This change allows users to specify an alternative temporary directory by setting the `TMPDIR` environment variable. ## Changes - Check if `TMPDIR` is set and points to a valid directory - Use `$TMPDIR` for temporary files if available - Fall back to `/tmp` if `TMPDIR` is not set or invalid ## Testing Tested the script with: - `TMPDIR` unset (uses `/tmp` as before) - `TMPDIR` set to a valid directory (uses specified directory) - `TMPDIR` set to an invalid path (falls back to `/tmp`) This change maintains backward compatibility while adding flexibility for environments with non-standard temporary directory requirements. Release Notes: - N/A --- script/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/install.sh b/script/install.sh index 9cd21119b7..feb140c984 100755 --- a/script/install.sh +++ b/script/install.sh @@ -9,7 +9,12 @@ main() { platform="$(uname -s)" arch="$(uname -m)" channel="${ZED_CHANNEL:-stable}" - temp="$(mktemp -d "/tmp/zed-XXXXXX")" + # Use TMPDIR if available (for environments with non-standard temp directories) + if [ -n "${TMPDIR:-}" ] && [ -d "${TMPDIR}" ]; then + temp="$(mktemp -d "$TMPDIR/zed-XXXXXX")" + else + temp="$(mktemp -d "/tmp/zed-XXXXXX")" + fi if [ "$platform" = "Darwin" ]; then platform="macos"