Safer zsh install script

This commit is contained in:
Henrik Lissner 2013-12-17 20:02:41 -05:00
parent ae941e03de
commit 69c6fbd9b8

View file

@ -10,32 +10,34 @@ if [ ! -d ~/.oh-my-zsh ]; then
fi fi
# https://github.com/robbyrussell/oh-my-zsh # https://github.com/robbyrussell/oh-my-zsh
echo_g "==> ZSH: Installing oh-my-zsh" if [ ! -d ~/.oh-my-zsh ]; then
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh echo_g "==> ZSH: Installing oh-my-zsh"
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
fi
# Set new shell # Set new shell
echo_g "==> ZSH: Changing shell" echo_g "==> ZSH: Changing shell"
if is_mac; then
local zsh_bin=$(which zsh) zsh_bin="`brew --prefix`/bin/zsh"
if !grep -i "$zsh_bin" /etc/shells; then echo $zsh_bin | sudo tee /etc/shells
echo_r "==> ZSH: You need to add $zsh_bin to /etc/shells!"
else else
chsh -s "$zsh_bin" zsh_bin="/usr/bin/zsh"
echo $zsh_bin | sudo tee -a /etc/shells
fi fi
# Change the shell
chsh -s "$zsh_bin"
else else
echo_g "==> ZSH: Updating" echo_g "==> ZSH: Updating"
cd ~/.oh-my-zsh cd ~/.oh-my-zsh
git pull git pull
fi fi
# Create links # Create links
echo_g "==> ZSH: Setting up symlinks" echo_g "==> ZSH: Setting up symlinks"
ln -sf ~/.dotfiles/zsh ~/.zsh rm -f ~/.zsh && ln -sf ~/.dotfiles/zsh ~/.zsh
ln -sf ~/.dotfiles/zshrc ~/.zshrc rm -f ~/.zshrc && ln -sf ~/.dotfiles/zshrc ~/.zshrc
ln -sf ~/.dotfiles/zshenv ~/.zshenv rm -f ~/.zshenv && ln -sf ~/.dotfiles/zshenv ~/.zshenv
ln -sf ~/.dotfiles/bashrc ~/.bashrc rm -f ~/.bashrc && ln -sf ~/.dotfiles/bashrc ~/.bashrc
echo_g "==> ZSH: DONE!" echo_g "==> ZSH: DONE!"