]> arthur.barton.de Git - OhMyZshExtensions.git/commitdiff
1_local.plugin.zsh: Setup locale cache and home directory paths
authorAlexander Barton <alex@barton.de>
Tue, 17 Mar 2015 13:40:34 +0000 (14:40 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 17 Mar 2015 13:40:34 +0000 (14:40 +0100)
plugins/1_local/1_local.plugin.zsh [new file with mode: 0644]

diff --git a/plugins/1_local/1_local.plugin.zsh b/plugins/1_local/1_local.plugin.zsh
new file mode 100644 (file)
index 0000000..27a6c3a
--- /dev/null
@@ -0,0 +1,15 @@
+# 1_local.plugin.zsh
+# 2015-03-17, alex@barton.de
+
+[ -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 XDG cache directory
+export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
+
+# Setup environment for ccache, if installed
+type ccache >/dev/null && export CCACHE_DIR="$XDG_CACHE_HOME/ccache"