-#fix permissions from git (TODO: should probably move this to git hook)
-chmod go= base/.zshenv base/.Xresources
-
-if [ 0 -eq 1 ]; then
- alias mkdir="echo mkdir"
- alias ln="echo ln"
- alias rm="echo rm"
- alias cap_mkdb="echo cap_mkdb"
- alias unlink="echo unlink"
+# install location and source files
+: ${DEST:=$(realpath "$HOME")}
+: ${SRC:=$(dirname "$(realpath "$0")")}
+
+# confirm XDG vars we care about are set up
+: ${LOCAL:=.local} # NOTE: needed for bin, which has no xdg var
+: ${XDG_DATA_HOME:=$DEST/$LOCAL/share}
+: ${XDG_CONFIG_HOME:=$DEST/.config}
+: ${XDG_STATE_HOME:=$DEST/$LOCAL/state}
+: ${XDG_CACHE_HOME:=$DEST/.cache}
+
+# these are the vars we actually use
+share="${XDG_DATA_HOME#$DEST/}"
+etc="${XDG_CONFIG_HOME#$DEST/}"
+state="${XDG_STATE_HOME#$DEST/}"
+cache="${XDG_CACHE_HOME#$DEST/}"
+
+# test
+devnull=/dev/null
+if [ "$1" = "test" ]; then
+ echo "Running test -- no changes will be applied"
+ devnull=/dev/stdout
+ _cd() {
+ cd $*;
+ echo "-- cd $* --> $PWD";
+ }
+ alias cd="_cd"
+ alias mkdir="echo -- mkdir"
+ alias ln="echo -- ln"
+ alias rm="echo -- rm"
+ alias sh="echo -- sh"
+fi
+
+# ensure ostype
+# NOTE: copied from .zshenv
+if [ -z "$OSTYPE" ]; then
+ OSTYPE=$(uname -s | tr '[:upper:]' '[:lower:]')