install.sh 1.68 KB
Newer Older
Andrew Vit's avatar
Andrew Vit committed
1
2
set -e

3
if [ ! -n $ZSH ]
Robby Russell's avatar
Robby Russell committed
4
then
5
6
7
8
  ZSH=~/.oh-my-zsh
fi

if [ -d $ZSH ]
9
then
10
  echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
Robby Russell's avatar
Robby Russell committed
11
12
13
  exit
fi

14
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
15
hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
16
17
  echo "git not installed"
  exit
Renan Cakirerk's avatar
Renan Cakirerk committed
18
}
Toon Claes's avatar
Toon Claes committed
19

20
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
21
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
Robby Russell's avatar
Robby Russell committed
22
then
Eric Mathison's avatar
Eric Mathison committed
23
  echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m";
24
  mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
Robby Russell's avatar
Robby Russell committed
25
26
fi

27
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
28
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
Andrew Vit's avatar
Andrew Vit committed
29
30
31
sed -i -e "/^ZSH=/ c\\
ZSH=$ZSH
" ~/.zshrc
Robby Russell's avatar
Robby Russell committed
32

33
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
34
35
36
sed -i -e "/export PATH=/ c\\
export PATH=\"$PATH\"
" ~/.zshrc
37

38
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
Arthur Kalmenson's avatar
Arthur Kalmenson committed
39
chsh -s `which zsh`
Robby Russell's avatar
Robby Russell committed
40

41
42
43
44
45
46
echo "\033[0;32m"'         __                                     __   '"\033[0m"
echo "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m"
echo "\033[0;32m"' / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ '"\033[0m"
echo "\033[0;32m"'/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / '"\033[0m"
echo "\033[0;32m"'\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '"\033[0m"
echo "\033[0;32m"'                        /____/                       '"\033[0m"
47

48
echo "\n\n \033[0;32m....is now installed.\033[0m"
49
echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
50
/usr/bin/env zsh
51
. ~/.zshrc