summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile18
-rwxr-xr-xinstallers/set_zshdirs.sh13
-rw-r--r--zsh/.zshenv1
3 files changed, 17 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 0faf846..e27af0a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,16 @@
VIM := $(shell command -v vim 2>/dev/null)
NVIM := $(shell command -v nvim 2>/dev/null)
-XCONFS := X11/Xresources
ZCONFS := zsh/.zshenv
-SCONFS := sh/profile
DCONFS := doas.conf
all:
-install: install-xconfigs install-shconfigs install-zshconfigs vimplug-vim vimplug-nvim
-
-install-xconfigs: $(XCONFS)
- @echo "Installing Xorg conf files..."
- @echo "Xresources..."
- @ln -sf `pwd`/X11/Xresources ~/.Xresources
- @echo "Done."
-
-install-shconfigs: $(SCONFS)
- @echo "Installing SH conf files..."
- @echo ".profile..."
- @ln -sf `pwd`/sh/profile ~/.profile
- @echo "Done."
+install: install-zshconfigs vimplug-vim vimplug-nvim
install-zshconfigs: $(ZCONFS)
@echo "Installing zsh conf files..."
+ @echo "Setting ZSHDOTDIR globally..."
+ @$(shell sudo installers/set_zshdirs.sh)
@echo ".zshenv..."
@ln -sf `pwd`/zsh/.zshenv ~/.zshenv
@echo "Done."
diff --git a/installers/set_zshdirs.sh b/installers/set_zshdirs.sh
new file mode 100755
index 0000000..2d82f19
--- /dev/null
+++ b/installers/set_zshdirs.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -f /etc/zshenv ]; then
+ ZSHENV="/etc/zshenv"
+elif [ -d /etc/zsh ]; then
+ ZSHENV="/etc/zsh/zshenv"
+else
+ ZSHENV="/etc/zshenv"
+fi
+
+if ! grep -q "ZDOTDIR" $ZSHENV 2>/dev/null; then
+ echo "export ZDOTDIR=\"\$HOME\"/.config/zsh" >> $ZSHENV
+fi
diff --git a/zsh/.zshenv b/zsh/.zshenv
index b8c9d48..f02f83a 100644
--- a/zsh/.zshenv
+++ b/zsh/.zshenv
@@ -1,4 +1,5 @@
# ZSH SPECIFIC CONFIGS
unset HISTFILE
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
+[ -f /etc/profile ] && . /etc/profile
[ -f "$XDG_CONFIG_HOME/sh/profile" ] && . "$XDG_CONFIG_HOME/sh/profile"