helm/install/zsh

42 lines
925 B
Bash
Executable file

#!/usr/bin/env bash
source ~/.dotfiles/zsh/functions
if [ ! -d ~/.oh-my-zsh ]; then
# Try to 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"
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# Set new shell
echo_g "==> ZSH: Changing shell"
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 "$zsh_bin"
fi
else
echo_g "==> ZSH: Updating"
cd ~/.oh-my-zsh
git pull
fi
# Create links
echo_g "==> ZSH: Setting up symlinks"
ln -sf ~/.dotfiles/zsh ~/.zsh
ln -sf ~/.dotfiles/zshrc ~/.zshrc
ln -sf ~/.dotfiles/zshenv ~/.zshenv
ln -sf ~/.dotfiles/bashrc ~/.bashrc
echo_g "==> ZSH: DONE!"