]> arthur.barton.de Git - ax-zsh.git/commitdiff
Split 30_env into "ax-io" and "zshrc" stage
authorAlexander Barton <alex@barton.de>
Sat, 26 Dec 2020 19:49:51 +0000 (20:49 +0100)
committerAlexander Barton <alex@barton.de>
Sat, 26 Dec 2020 19:49:53 +0000 (20:49 +0100)
We want it to fix TMPDIR etc. in non-login shells, too! And this makes
sense, as there are some startup sequences (for example when using
screen(1) or tmux(1)) which result in br0ken TMPDIR settings ..

core/30_env/30_env.ax-io
core/30_env/30_env.zshrc [new file with mode: 0644]

index 87875402633f5563ea1f596cab2bdc09701117fe..984b9599ad6fb674813b1b52aea080d547cca1ff 100644 (file)
@@ -14,13 +14,6 @@ fi
 if [[ ! -w "$TMPDIR" ]]; then
        echo "WARNING: Temporary directory \"$TMPDIR\" is not writable!" >&2
 fi
-# Make sure TMPDIR ends in a slash (like on macOS by default): this makes its
-# usage a bit safer ...
-case "$TMPDIR" in
-       */) ;;
-       *)  TMPDIR="$TMPDIR/"
-esac
-export TMPDIR
 
 # Setup XDG cache directory
 if [[ -z "$XDG_CACHE_HOME" ]]; then
diff --git a/core/30_env/30_env.zshrc b/core/30_env/30_env.zshrc
new file mode 100644 (file)
index 0000000..4187712
--- /dev/null
@@ -0,0 +1,17 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 30_env.ax-io: Setup environment
+
+# Make sure TMPDIR ends in a slash (like on macOS by default): this makes its
+# usage a bit safer ...
+case "$TMPDIR" in
+       */) ;;
+       *)  TMPDIR="$TMPDIR/"
+esac
+export TMPDIR
+
+# TMPDIR is the only one required to be set, but make sure that TMP, TEMP
+# and TEMPDIR are set to the same sane path name when already present in the
+# environment:
+[[ -n "$TMP" ]] && TMP="$TMPDIR"
+[[ -n "$TEMP" ]] && TEMP="$TMPDIR"
+[[ -n "$TEMPDIR" ]] && TEMPDIR="$TMPDIR"