]> arthur.barton.de Git - ConfigScripts.git/blobdiff - sys/profile
sys/bashrc: Search for /etc/profile in ~/.etc/profile, too
[ConfigScripts.git] / sys / profile
index 15cee68c9434995a977006a726e42b38cc036f24..a190bd78f570c76e8d84de594808f3533487f2aa 100644 (file)
@@ -105,10 +105,23 @@ fi
 [ -n "$HOSTNAME" ] || HOSTNAME=`hostname 2>/dev/null`
 export HOSTNAME
 
+# Setup local home directory, when available
+[ -d "/usr/local/home" -a ! -d "/usr/local/home/$LOGNAME" ] \
+       && mkdir "/usr/local/home/$LOGNAME" >/dev/null 2>&1
+[ -w "/usr/local/home/$LOGNAME" ] \
+       && export LOCAL_HOME="/usr/local/home/$LOGNAME" \
+       || export LOCAL_HOME="$HOME"
+
+# Setup environment to use local storage (no NFS, if possible!)
+export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
+
+# Setup environment for ccache, if installed
+type -t ccache >/dev/null && export CCACHE_DIR="$XDG_CACHE_HOME/ccache"
+
 # Setup environment for Python "pip", if installed
 if [ "$(type -t pip 2>/dev/null)" ]; then
        export PIP_REQUIRE_VIRTUALENV=true
-       export PIP_DOWNLOAD_CACHE="$HOME/.cache/pip"
+       export PIP_DOWNLOAD_CACHE="$XDG_CACHE_HOME/pip"
 fi
 
 # Move Xauthority file to local storage, so that sudo et all work
@@ -137,15 +150,6 @@ fi
 # read local profile, if available
 [ -r "/var/lib/${HOSTNAME}/profile" ] && . /var/lib/${HOSTNAME}/profile
 
-# Setup some directories to use local storage (no NFS)
-[ -d "/usr/local/home/$LOGNAME" ] \
-       || ( mkdir /usr/local/home; mkdir "/usr/local/home/$LOGNAME" ) >/dev/null 2>&1
-if [ -w "/usr/local/home/$LOGNAME" ]; then
-       export LOCAL_HOME="/usr/local/home/$LOGNAME"
-       export CCACHE_DIR="$LOCAL_HOME/.ccache"
-       export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
-fi
-
 # interactive shell?
 [ "$PS1" ] || return