Commit 64d120e1b501568e24625a3e8eebae4646b00db8
1 parent
d11596f4c9
Exists in
master
and in
2 other branches
remove the old shit beforehand
Showing 1 changed file with 17 additions and 5 deletions Inline Diff
tools/install.sh
| 1 | # ** Initiate with: ** | 1 | # ** Initiate with: ** |
| 2 | # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/install.sh -O -| sh | 2 | # cd && wget http://git.str8.biz/mj/zsh-config/raw/master/tools/install.sh -O -| sh |
| 3 | # ----------------------------------------------------------------------------------- | 3 | # ----------------------------------------------------------------------------------- |
| 4 | 4 | ||
| 5 | set -e | 5 | set -e |
| 6 | 6 | ||
| 7 | if [ ! -n "$ZCNF" ]; then | 7 | if [ ! -n "$ZCNF" ]; then |
| 8 | ZCNF=~/.config/zsh-config | 8 | ZCNF=~/.config/zsh-config |
| 9 | fi | 9 | fi |
| 10 | 10 | ||
| 11 | if [ ! -n "$ZSH" ]; then | 11 | if [ ! -n "$ZSH" ]; then |
| 12 | ZSH=$ZCNF/tools/oh-my-zsh | 12 | ZSH=$ZCNF/tools/oh-my-zsh |
| 13 | fi | 13 | fi |
| 14 | 14 | ||
| 15 | echo "\033[0;34mCleaning...\033[0m" | ||
| 16 | if [ -d ~/.config ]; then | ||
| 17 | if [ -d ~/.config/oh-my-zsh ]; then | ||
| 18 | rm -rf ~/.config/oh-my-zsh | ||
| 19 | fi | ||
| 20 | if [ -d ~/.config/antigen ]; then | ||
| 21 | rm -rf ~/.config/antigen | ||
| 22 | fi | ||
| 23 | fi | ||
| 24 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | ||
| 25 | rm ~/.zshrc | ||
| 26 | fi | ||
| 27 | if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then | ||
| 28 | rm ~/.bash_aliases | ||
| 29 | fi | ||
| 30 | |||
| 15 | echo "\033[0;34mCloning Zsh Config...\033[0m" | 31 | echo "\033[0;34mCloning Zsh Config...\033[0m" |
| 16 | hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { | 32 | hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { |
| 17 | echo "can't clone repo.. trying to pull" | 33 | echo "can't clone repo.." |
| 18 | hash git >/dev/null 2>&1 && env git pull --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { | ||
| 19 | echo "can't pull, either.. giving up.." | ||
| 20 | } | ||
| 21 | } | 34 | } |
| 22 | 35 | ||
| 23 | echo "\033[0;34mLooking for an existing zsh config...\033[0m" | 36 | echo "\033[0;34mLooking for an existing zsh config...\033[0m" |
| 24 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | 37 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then |
| 25 | echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-zsh-cnf\033[0m"; | 38 | echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-zsh-cnf\033[0m"; |
| 26 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf; | 39 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf; |
| 27 | fi | 40 | fi |
| 28 | 41 | ||
| 29 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" | 42 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" |
| 30 | ln -s $ZCNF/templates/zshrc ~/.zshrc | 43 | ln -s $ZCNF/templates/zshrc ~/.zshrc |
| 31 | rm ~/.bash_aliases | ||
| 32 | ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases | 44 | ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases |
| 33 | sed -i -e "/^export ZSH=/ c\\ | 45 | sed -i -e "/^export ZSH=/ c\\ |
| 34 | export ZSH=$ZSH | 46 | export ZSH=$ZSH |
| 35 | " ~/.zshrc | 47 | " ~/.zshrc |
| 36 | 48 | ||
| 37 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" | 49 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" |
| 38 | sed -i -e "/export PATH=/ c\\ | 50 | sed -i -e "/export PATH=/ c\\ |
| 39 | export PATH=\"$PATH\" | 51 | export PATH=\"$PATH\" |
| 40 | " ~/.zshrc | 52 | " ~/.zshrc |
| 41 | 53 | ||
| 42 | if [ "$SHELL" != "$(which zsh)" ]; then | 54 | if [ "$SHELL" != "$(which zsh)" ]; then |
| 43 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" | 55 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" |
| 44 | chsh -s `which zsh` | 56 | chsh -s `which zsh` |
| 45 | fi | 57 | fi |
| 46 | 58 | ||
| 47 | echo "\033[0;32m"' __ __ '"\033[0m" | 59 | echo "\033[0;32m"' __ __ '"\033[0m" |
| 48 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" | 60 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
| 49 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" | 61 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
| 50 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" | 62 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
| 51 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" | 63 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
| 52 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" | 64 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" |
| 53 | echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" | 65 | echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" |
| 54 | echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" | 66 | echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" |