#!/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 if [ ! -d ~/.oh-my-zsh ]; then echo_g "==> ZSH: Installing oh-my-zsh" git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh fi # Set new shell echo_g "==> ZSH: Changing shell" if is_mac; then zsh_bin="`brew --prefix`/bin/zsh" echo $zsh_bin | sudo tee /etc/shells else zsh_bin="/usr/bin/zsh" echo $zsh_bin | sudo tee -a /etc/shells fi # Change the shell chsh -s "$zsh_bin" else echo_g "==> ZSH: Updating" cd ~/.oh-my-zsh git pull fi # Create links echo_g "==> ZSH: Setting up symlinks" rm -f ~/.zsh && ln -sf ~/.dotfiles/zsh ~/.zsh rm -f ~/.zshrc && ln -sf ~/.dotfiles/zshrc ~/.zshrc rm -f ~/.zshenv && ln -sf ~/.dotfiles/zshenv ~/.zshenv rm -f ~/.bashrc && ln -sf ~/.dotfiles/bashrc ~/.bashrc echo_g "==> ZSH: DONE!"