Commit 8f57b7c38b6fec912236160b268aa8ba3291f60f
1 parent
80d0010466
Exists in
master
and in
1 other branch
[FIX] install.sh: DON'T ALWAYS INSTALL:
if [ ! -n "$DONTINSTALL" ]; then DONTINSTALL="1" fi
Showing 1 changed file with 15 additions and 9 deletions Inline Diff
tools/install.sh
1 | #@IgnoreInspection AddShebang | 1 | #@IgnoreInspection AddShebang |
2 | # | 2 | # |
3 | # ** Initiate with: ** | 3 | # ** Initiate with: ** |
4 | # cd && curl -L http://git.str8.biz/mj/zsh-config/raw/master/tools/install.sh | sh | 4 | # cd && curl -L http://git.str8.biz/mj/zsh-config/raw/master/tools/install.sh | sh |
5 | # | 5 | # |
6 | # --------------------------------------------------------------------------------------------- | 6 | # --------------------------------------------------------------------------------------------- |
7 | # | 7 | # |
8 | # gj@ubuntu4docker:~$ touch install.sh | 8 | # gj@ubuntu4docker:~$ touch install.sh |
9 | # gj@ubuntu4docker:~$ rm install.sh && nano install.sh && chmod +x install.sh && ./install.sh | 9 | # gj@ubuntu4docker:~$ rm install.sh && nano install.sh && chmod +x install.sh && ./install.sh |
10 | # | 10 | # |
11 | ################################################################################################ | 11 | ################################################################################################ |
12 | 12 | ||
13 | set -e | 13 | set -e |
14 | 14 | ||
15 | if [ -d /proc/vz ] && [ ! -d /proc/vz/beancounter ] && [ ! $DONTINSTALL ]; then | 15 | if [ ! -n "$DONTINSTALL" ]; then |
16 | apt-get -yq install curl dialog git nano screen zsh | 16 | DONTINSTALL="1" |
17 | else | 17 | fi |
18 | if [ "$UID" != 0 ]; then CMD_PREFIX="sudo"; else CMD_PREFIX=""; fi | 18 | |
19 | if [ ! $DONTINSTALL ]; then | ||
20 | if [ -d /proc/vz ] && [ ! -d /proc/vz/beancounter ]; then | ||
21 | apt-get -yq install curl dialog git nano screen zsh | ||
22 | else | ||
23 | if [ "$UID" != 0 ]; then CMD_PREFIX="sudo"; else CMD_PREFIX=""; fi | ||
19 | 24 | ||
20 | if [ "$SHELL" != "$(which zsh)" ]; then | 25 | if [ "$SHELL" != "$(which zsh)" ]; then |
21 | echo "$(which zsh)" | 26 | echo "$(which zsh)" |
22 | $CMD_PREFIX echo "enter pass...." | 27 | $CMD_PREFIX echo "enter pass...." |
23 | 28 | ||
24 | echo "ok" | 29 | echo "ok" |
25 | 30 | ||
26 | $CMD_PREFIX apt-get -yq install curl dialog git nano zsh | 31 | $CMD_PREFIX apt-get -yq install curl dialog git nano zsh |
32 | fi | ||
27 | fi | 33 | fi |
28 | fi | 34 | fi |
29 | 35 | ||
30 | if [ ! -n "$HOME" ]; then | 36 | if [ ! -n "$HOME" ]; then |
31 | HOME=~/ | 37 | HOME=~/ |
32 | fi | 38 | fi |
33 | 39 | ||
34 | if [ ! -n "$ZCNF" ]; then | 40 | if [ ! -n "$ZCNF" ]; then |
35 | ZCNF=$HOME/.config/zsh-config | 41 | ZCNF=$HOME/.config/zsh-config |
36 | fi | 42 | fi |
37 | 43 | ||
38 | if [ ! -n "$ZSH" ]; then | 44 | if [ ! -n "$ZSH" ]; then |
39 | ZSH=$ZCNF/repos/oh-my-zsh | 45 | ZSH=$ZCNF/repos/oh-my-zsh |
40 | fi | 46 | fi |
41 | 47 | ||
42 | echo "\033[0;34mCleaning...\033[0m" | 48 | echo "\033[0;34mCleaning...\033[0m" |
43 | if [ -d ~/.config/zsh-config ] || [ -h ~/.config/zsh-config ]; then | 49 | if [ -d ~/.config/zsh-config ] || [ -h ~/.config/zsh-config ]; then |
44 | rm -rf ~/.config/zsh-config | 50 | rm -rf ~/.config/zsh-config |
45 | fi | 51 | fi |
46 | 52 | ||
47 | if [ -d ~/.config/oh-my-zsh ] || [ -h ~/.config/oh-my-zsh ]; then | 53 | if [ -d ~/.config/oh-my-zsh ] || [ -h ~/.config/oh-my-zsh ]; then |
48 | rm -rf ~/.config/oh-my-zsh | 54 | rm -rf ~/.config/oh-my-zsh |
49 | fi | 55 | fi |
50 | 56 | ||
51 | if [ -d ~/.config/antigen ] || [ -h ~/.config/antigen ]; then | 57 | if [ -d ~/.config/antigen ] || [ -h ~/.config/antigen ]; then |
52 | rm -rf ~/.config/antigen | 58 | rm -rf ~/.config/antigen |
53 | fi | 59 | fi |
54 | 60 | ||
55 | if [ -d ~/.oh-my-zsh ] || [ -h ~/.oh-my-zsh ]; then | 61 | if [ -d ~/.oh-my-zsh ] || [ -h ~/.oh-my-zsh ]; then |
56 | rm -rf ~/.oh-my-zsh | 62 | rm -rf ~/.oh-my-zsh |
57 | fi | 63 | fi |
58 | 64 | ||
59 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then | 65 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then |
60 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf | 66 | mv ~/.zshrc ~/.zshrc.pre-zsh-cnf |
61 | fi | 67 | fi |
62 | 68 | ||
63 | # | 69 | # |
64 | # BASH: | 70 | # BASH: |
65 | # | 71 | # |
66 | if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then | 72 | if [ -f ~/.bashrc ] || [ -h ~/.bashrc ]; then |
67 | mv ~/.bashrc ~/.bashrc.pre-zsh-cnf | 73 | mv ~/.bashrc ~/.bashrc.pre-zsh-cnf |
68 | fi | 74 | fi |
69 | if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then | 75 | if [ -f ~/.bash_aliases ] || [ -h ~/.bash_aliases ]; then |
70 | rm ~/.bash_aliases | 76 | rm ~/.bash_aliases |
71 | fi | 77 | fi |
72 | 78 | ||
73 | echo "\033[0;34mCloning Zsh Config...\033[0m" | 79 | echo "\033[0;34mCloning Zsh Config...\033[0m" |
74 | hash git >/dev/null 2>&1 && env git clone --branch master --single-branch --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { | 80 | hash git >/dev/null 2>&1 && env git clone --branch master --single-branch --depth=1 http://git.str8.biz/mj/zsh-config.git $ZCNF || { |
75 | echo "can't clone repo.." | 81 | echo "can't clone repo.." |
76 | exit 1 | 82 | exit 1 |
77 | } | 83 | } |
78 | 84 | ||
79 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" | 85 | echo "\033[0;34mUsing the Zsh Config template file and adding it to ~/.zshrc\033[0m" |
80 | cp $ZCNF/templates/zshrc.sh ~/.zshrc | 86 | cp $ZCNF/templates/zshrc.sh ~/.zshrc |
81 | cp $ZCNF/templates/bashrc.sh ~/.bashrc | 87 | cp $ZCNF/templates/bashrc.sh ~/.bashrc |
82 | 88 | ||
83 | #sed -i -e "/^export ZSH=/ c\\ | 89 | #sed -i -e "/^export ZSH=/ c\\ |
84 | #export ZSH=$ZSH | 90 | #export ZSH=$ZSH |
85 | #" ~/.zshrc | 91 | #" ~/.zshrc |
86 | 92 | ||
87 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" | 93 | echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" |
88 | sed -i -e "/export PATH=/ c\\ | 94 | sed -i -e "/export PATH=/ c\\ |
89 | export PATH=\"$PATH\" | 95 | export PATH=\"$PATH\" |
90 | " ~/.zshrc | 96 | " ~/.zshrc |
91 | 97 | ||
92 | if [ "$SHELL" != "$(which zsh)" ]; then | 98 | if [ "$SHELL" != "$(which zsh)" ]; then |
93 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" | 99 | echo "\033[0;34mTime to change your default shell to zsh!\033[0m" |
94 | # echo "chsh -s $(which zsh)" | 100 | # echo "chsh -s $(which zsh)" |
95 | echo "chsh -s /bin/zsh" | 101 | echo "chsh -s /bin/zsh" |
96 | fi | 102 | fi |
97 | 103 | ||
98 | echo "\033[0;32m"' __ __ '"\033[0m" | 104 | echo "\033[0;32m"' __ __ '"\033[0m" |
99 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" | 105 | echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
100 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" | 106 | echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
101 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" | 107 | echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
102 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" | 108 | echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
103 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" | 109 | echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" |
104 | echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" | 110 | echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" |
105 | echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" | 111 | echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" |
106 | echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m" | 112 | echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m" |
107 | #env zsh | 113 | #env zsh |
108 | #. ~/.zshrc | 114 | #. ~/.zshrc |
109 | 115 |