Commit 960ce859362cd83406c9865a614a176227ad879e

Authored by mj
1 parent 5beaacef57
Exists in master and in 2 other branches 02-merge, dev

ADD tools/install.sh

Showing 1 changed file with 52 additions and 0 deletions Side-by-side Diff

... ... @@ -0,0 +1,52 @@
  1 +set -e
  2 +
  3 +if [ ! -n "$ZCNF" ]; then
  4 + ZCNF=~/.config/zsh-config
  5 +fi
  6 +
  7 +if [ ! -n "$ZSH" ]; then
  8 + ZSH=~/.config/zsh-config/tools/oh-my-zsh
  9 +fi
  10 +
  11 +echo "\033[0;34mCloning Zsh Config...\033[0m"
  12 +hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || {
  13 + echo "git not installed"
  14 + exit
  15 +}
  16 +
  17 +echo "\033[0;34mLooking for an existing zsh config...\033[0m"
  18 +if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
  19 + echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-zsh-cnf\033[0m";
  20 + mv ~/.zshrc ~/.zshrc.pre-zsh-cnf;
  21 +fi
  22 +
  23 +echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m"
  24 +ln -s $ZCNF/templates/zshrc ~/.zshrc
  25 +ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases
  26 +sed -i -e "/^export ZSH=/ c\\
  27 +export ZSH=$ZSH
  28 +" ~/.zshrc
  29 +
  30 +echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
  31 +sed -i -e "/export PATH=/ c\\
  32 +export PATH=\"$PATH\"
  33 +" ~/.zshrc
  34 +
  35 +if [ "$SHELL" != "$(which zsh)" ]; then
  36 + echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
  37 + chsh -s `which zsh`
  38 +fi
  39 +
  40 +echo "\033[0;32m"' __ __ '"\033[0m"
  41 +echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
  42 +echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
  43 +echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
  44 +echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
  45 +echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
  46 +echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
  47 +echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m"
  48 +echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m"
  49 +env zsh
  50 +. ~/.zshrc
  51 +
  52 +