Commit 8bc71a901a9b7ec9c3e6fffd03b2f4268599778c
1 parent
da5bd4cbf8
Exists in
master
and in
2 other branches
install.sh: fix clearing
Showing 1 changed file with 12 additions and 13 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" | 15 | echo "\033[0;34mCleaning...\033[0m" |
16 | if [ -d ~/.config/zsh-config ] || [ -h ~/.config/zsh-config ]; then | 16 | if [ -d ~/.config/zsh-config ] || [ -h ~/.config/zsh-config ]; then |
17 | if [ -d ~/.config/zsh-config ] || [ -h ~/.config/zsh-config ]; then | 17 | if [ -d ~/.config/zsh-config ] || [ -h ~/.config/zsh-config ]; then |
18 | rm -rf ~/.config/zsh-config | 18 | rm -rf ~/.config/zsh-config |
19 | fi | 19 | fi |
20 | if [ -d ~/.config/oh-my-zsh ] || [ -h ~/.config/oh-my-zsh ]; then | 20 | if [ -d ~/.config/oh-my-zsh ] || [ -h ~/.config/oh-my-zsh ]; then |
21 | rm -rf ~/.config/oh-my-zsh | 21 | rm -rf ~/.config/oh-my-zsh |
22 | fi | 22 | fi |
23 | if [ -d ~/.config/antigen ] || [ -h ~/.config/antigen ]; then | 23 | if [ -d ~/.config/antigen ] || [ -h ~/.config/antigen ]; then |
24 | rm -rf ~/.config/antigen | 24 | rm -rf ~/.config/antigen |
25 | fi | 25 | fi |
26 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | 26 | fi |
27 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf | ||
28 | fi | ||
29 | |||
30 | # | ||
31 | # BASH: | ||
32 | # | ||
33 | 27 | ||
34 | if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then | 28 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then |
35 | mv ~/.bashrc ~/.bashrc.pre-zsh-cnf | 29 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf |
36 | fi | 30 | fi |
37 | if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then | 31 | # |
38 | rm ~/.bash_aliases | 32 | # BASH: |
39 | fi | 33 | # |
34 | if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then | ||
35 | mv ~/.bashrc ~/.bashrc.pre-zsh-cnf | ||
36 | fi | ||
37 | if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then | ||
38 | rm ~/.bash_aliases | ||
40 | fi | 39 | fi |
41 | 40 | ||
42 | echo "\033[0;34mCloning Zsh Config...\033[0m" | 41 | echo "\033[0;34mCloning Zsh Config...\033[0m" |
43 | hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { | 42 | hash git >/dev/null 2>&1 && env git clone --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { |
44 | echo "can't clone repo.." | 43 | echo "can't clone repo.." |
45 | exit 1 | 44 | exit 1 |
46 | } | 45 | } |
47 | 46 | ||
48 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" | 47 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" |
49 | ln -s $ZCNF/templates/zshrc ~/.zshrc | 48 | ln -s $ZCNF/templates/zshrc ~/.zshrc |
50 | ln -s $ZCNF/templates/bashrc ~/.bashrc | 49 | ln -s $ZCNF/templates/bashrc ~/.bashrc |
51 | ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases | 50 | ln -s $ZCNF/templates/bash_aliases ~/.bash_aliases |
52 | sed -i -e "/^export ZSH=/ c\\ | 51 | sed -i -e "/^export ZSH=/ c\\ |
53 | export ZSH=$ZSH | 52 | export ZSH=$ZSH |
54 | " ~/.zshrc | 53 | " ~/.zshrc |
55 | 54 | ||
56 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" | 55 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" |
57 | sed -i -e "/export PATH=/ c\\ | 56 | sed -i -e "/export PATH=/ c\\ |
58 | export PATH=\"$PATH\" | 57 | export PATH=\"$PATH\" |
59 | " ~/.zshrc | 58 | " ~/.zshrc |
60 | 59 | ||
61 | if [ "$SHELL" != "$(which zsh)" ]; then | 60 | if [ "$SHELL" != "$(which zsh)" ]; then |
62 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" | 61 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" |
63 | # chsh -s `which zsh` | 62 | # chsh -s `which zsh` |
64 | fi | 63 | fi |
65 | 64 | ||
66 | echo "\033[0;32m"' __ __ '"\033[0m" | 65 | echo "\033[0;32m"' __ __ '"\033[0m" |
67 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" | 66 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
68 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" | 67 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
69 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" | 68 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
70 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" | 69 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
71 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" | 70 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" |
72 | echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" | 71 | echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" |