scatterd-dotfiles/hooks/post-up
Mislav Marohnić 16219a31db Move broken OS X /etc/zshenv detection to post-up hook
This is so it doesn't run every time when zsh starts in interactive
mode, but just once per `rcup`.
2015-10-23 12:26:11 -04:00

34 lines
1,014 B
Bash
Executable file

#!/bin/bash
touch $HOME/.psqlrc.local
if [ ! -e $HOME/.vim/autoload/plug.vim ]; then
curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim -u $HOME/.vimrc.bundles +PlugInstall +PlugClean! +qa
# detect old OS X broken /etc/zshenv and suggest rename
if grep -qw path_helper /etc/zshenv 2>/dev/null; then
fg_red=$'\e[31m'
fg_bold_white=$'\e[1;37m'
reset_color=$'\e[m'
# resolve BASH_SOURCE to absolute path
bash_source="$BASH_SOURCE"
if [[ $bash_source == */* ]]; then
pushd "${bash_source%/*}" >/dev/null
bash_source="${PWD}/${bash_source##*/}"
popd >/dev/null
fi
cat <<MSG >&2
${fg_red}Warning:${reset_color} \`/etc/zshenv' configuration file on your system may cause unexpected
PATH changes on subsequent invocations of the zsh shell. The solution is to
rename the file to \`zprofile':
${fg_bold_white}sudo mv /etc/{zshenv,zprofile}${reset_color}
(called from ${bash_source}:${LINENO})
MSG
fi