From cfaae7e2a7679a848c18481161158f7f945f329f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 18 Oct 2013 09:52:33 -0400 Subject: [PATCH] Test if brew is installed and if the zsh bin is in /etc/shells --- install/zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install/zsh b/install/zsh index 7a0fdf56..21b6ef16 100755 --- a/install/zsh +++ b/install/zsh @@ -4,7 +4,10 @@ source ~/.dotfiles/zsh/functions if [ ! -d ~/.oh-my-zsh ]; then # Try to install zsh - pkg_install zsh + if ! pkg_install zsh; then + echo_g "==> ZSH: Homebrew is not installed!" + exit 1 + fi # https://github.com/robbyrussell/oh-my-zsh echo_g "==> ZSH: Installing oh-my-zsh" @@ -12,7 +15,14 @@ if [ ! -d ~/.oh-my-zsh ]; then # Set new shell echo_g "==> ZSH: Changing shell" - chsh -s $(which zsh) + + local zsh_bin=$(which zsh) + if !grep -i "$zsh_bin" /etc/shells; then + echo_r "==> ZSH: You need to add $zsh_bin to /etc/shells!" + else + chsh -s $(which zsh) + fi + else echo_g "==> ZSH: Updating" cd ~/.oh-my-zsh