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`.
This commit is contained in:
parent
5d397e6fa5
commit
16219a31db
2 changed files with 26 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
touch $HOME/.psqlrc.local
|
||||
|
||||
|
@ -7,3 +7,28 @@ if [ ! -e $HOME/.vim/autoload/plug.vim ]; then
|
|||
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
|
||||
|
|
13
zshrc
13
zshrc
|
@ -111,18 +111,5 @@ _load_settings() {
|
|||
}
|
||||
_load_settings "$HOME/.zsh/configs"
|
||||
|
||||
# detect old OS X broken /etc/zshenv and suggest rename
|
||||
if grep -qw path_helper /etc/zshenv 2>/dev/null; then
|
||||
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 ${(%):-%N:%i})
|
||||
|
||||
MSG
|
||||
fi
|
||||
|
||||
# Local config
|
||||
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
|
||||
|
|
Loading…
Add table
Reference in a new issue