TZ=$(<"/etc/timezone") export TZ
fi
+# Validate temporary directory
+if [[ -z "$TMPDIR" ]]; then
+ TMPDIR="$(dirname $(mktemp -ut tmp.XXXXXXXXXX))/"
+ echo "WARNING: \"TMPDIR\" is not set, using \"$TMPDIR\" as default!" >&2
+fi
+if [[ ! -w "$TMPDIR" ]]; then
+ echo "WARNING: Temporary directory \"$TMPDIR\" is not writable!" >&2
+fi
+
# Setup XDG cache directory
if [[ -z "$XDG_CACHE_HOME" ]]; then
XDG_CACHE_HOME="$LOCAL_HOME/.cache"
# Setup XDG runtime directory
if [[ -z "$XDG_RUNTIME_DIR" ]]; then
- XDG_RUNTIME_DIR="${TMPDIR:-/tmp/${UID}-runtime-dir}"
+ XDG_RUNTIME_DIR="$TMPDIR/runtime-dir.$UID"
fi
if [[ ! -d "$XDG_RUNTIME_DIR" ]]; then
mkdir -p "$XDG_RUNTIME_DIR"