ca5632bce10e1f5b0fe2a59151ae0fd776619d89
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/tools/install.sh b/tools/install.sh
2index be43968bce1dcf9ece4daa28324b0695009bfa4c..8cba52085568fb75f8e90e33a8394080b82110bf 100755
3--- a/tools/install.sh
4+++ b/tools/install.sh
5@@ -1,118 +1,122 @@
6-# Use colors, but only if connected to a terminal, and that terminal
7-# supports them.
8-if which tput >/dev/null 2>&1; then
9- ncolors=$(tput colors)
10-fi
11-if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
12- RED="$(tput setaf 1)"
13- GREEN="$(tput setaf 2)"
14- YELLOW="$(tput setaf 3)"
15- BLUE="$(tput setaf 4)"
16- BOLD="$(tput bold)"
17- NORMAL="$(tput sgr0)"
18-else
19- RED=""
20- GREEN=""
21- YELLOW=""
22- BLUE=""
23- BOLD=""
24- NORMAL=""
25-fi
26+main() {
27+ # Use colors, but only if connected to a terminal, and that terminal
28+ # supports them.
29+ if which tput >/dev/null 2>&1; then
30+ ncolors=$(tput colors)
31+ fi
32+ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
33+ RED="$(tput setaf 1)"
34+ GREEN="$(tput setaf 2)"
35+ YELLOW="$(tput setaf 3)"
36+ BLUE="$(tput setaf 4)"
37+ BOLD="$(tput bold)"
38+ NORMAL="$(tput sgr0)"
39+ else
40+ RED=""
41+ GREEN=""
42+ YELLOW=""
43+ BLUE=""
44+ BOLD=""
45+ NORMAL=""
46+ fi
47
48-# Only enable exit-on-error after the non-critical colorization stuff,
49-# which may fail on systems lacking tput or terminfo
50-set -e
51+ # Only enable exit-on-error after the non-critical colorization stuff,
52+ # which may fail on systems lacking tput or terminfo
53+ set -e
54
55-CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
56-if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
57- printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
58- exit
59-fi
60-unset CHECK_ZSH_INSTALLED
61+ CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
62+ if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
63+ printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
64+ exit
65+ fi
66+ unset CHECK_ZSH_INSTALLED
67
68-if [ ! -n "$ZSH" ]; then
69- ZSH=~/.oh-my-zsh
70-fi
71+ if [ ! -n "$ZSH" ]; then
72+ ZSH=~/.oh-my-zsh
73+ fi
74
75-if [ -d "$ZSH" ]; then
76- printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
77- printf "You'll need to remove $ZSH if you want to re-install.\n"
78- exit
79-fi
80+ if [ -d "$ZSH" ]; then
81+ printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
82+ printf "You'll need to remove $ZSH if you want to re-install.\n"
83+ exit
84+ fi
85
86-# Prevent the cloned repository from having insecure permissions. Failing to do
87-# so causes compinit() calls to fail with "command not found: compdef" errors
88-# for users with insecure umasks (e.g., "002", allowing group writability). Note
89-# that this will be ignored under Cygwin by default, as Windows ACLs take
90-# precedence over umasks except for filesystems mounted with option "noacl".
91-umask g-w,o-w
92+ # Prevent the cloned repository from having insecure permissions. Failing to do
93+ # so causes compinit() calls to fail with "command not found: compdef" errors
94+ # for users with insecure umasks (e.g., "002", allowing group writability). Note
95+ # that this will be ignored under Cygwin by default, as Windows ACLs take
96+ # precedence over umasks except for filesystems mounted with option "noacl".
97+ umask g-w,o-w
98
99-printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
100-hash git >/dev/null 2>&1 || {
101- echo "Error: git is not installed"
102- exit 1
103-}
104-env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {