f94443925dacf44ad24e0efef9e486afb1c9c4d0
- 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 b1327af41a667b173bf3ab93df4b6f332c5a7a76..f7eee4daba48e28ab0c71b9afcf929382a665316 100755
3--- a/tools/install.sh
4+++ b/tools/install.sh
5@@ -1,7 +1,18 @@
6 #!/bin/sh
7+#
8+# This script should be run via curl:
9+# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
10+# or wget:
11+# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
12+#
13+# As an alternative, you can download the install script separately and
14+# run it afterwards with `sh install.sh'
15+#
16 set -e
17
18-# Test command existence (POSIX compatible)
19+# Default location
20+ZSH=${ZSH:-~/.oh-my-zsh}
21+
22 command_exists() {
23 command -v "$@" >/dev/null 2>&1
24 }
25@@ -30,17 +41,15 @@ main() {
26 fi
27
28 if ! command_exists zsh; then
29- printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
30+ echo "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!"
31 exit 1
32 fi
33
34- if [ ! -n "$ZSH" ]; then
35- ZSH=~/.oh-my-zsh
36- fi
37-
38 if [ -d "$ZSH" ]; then
39- printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
40- printf "You'll need to remove $ZSH if you want to re-install.\n"
41+ cat <<-EOF
42+ ${YELLOW}You already have Oh My Zsh installed.${NORMAL}
43+ You'll need to remove $ZSH if you want to re-install.
44+ EOF
45 exit 1
46 fi
47
48@@ -51,31 +60,34 @@ main() {
49 # precedence over umasks except for filesystems mounted with option "noacl".
50 umask g-w,o-w
51
52- printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
53+ echo "${BLUE}Cloning Oh My Zsh...${NORMAL}"
54+
55 command_exists git || {
56 echo "Error: git is not installed"
57 exit 1
58 }
59- # The Windows (MSYS) Git is not compatible with normal use on cygwin
60- if [ "$OSTYPE" = cygwin ]; then
61- if git --version | grep msysgit > /dev/null; then
62- echo "Error: Windows/MSYS Git is not supported on Cygwin"
63- echo "Error: Make sure the Cygwin git package is installed and is first on the path"
64- exit 1
65- fi
66+
67+ if [ "$OSTYPE" = cygwin ] && git --version | grep -q msysgit; then
68+ cat <<-EOF
69+ Error: Windows/MSYS Git is not supported on Cygwin
70+ Error: Make sure the Cygwin git package is installed and is first on the $PATH
71+ EOF
72+ exit 1
73 fi
74- env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
75- printf "Error: git clone of oh-my-zsh repo failed\n"
76+
77+ git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
78+ echo "Error: git clone of oh-my-zsh repo failed"
79 exit 1
80 }
81
82- printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
83+ echo "${BLUE}Looking for an existing zsh config...${NORMAL}"
84 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
85- printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
86+ echo "${YELLOW}Found ~/.zshrc.${GREEN} Backing up to ~/.zshrc.pre-oh-my-zsh.${NORMAL}"
87 mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
88 fi
89
90- printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
91+ echo "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc.${NORMAL}"
92+
93 cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
94 sed "/^export ZSH=/ c\\
95 export ZSH=\"$ZSH\"
96@@ -87,31 +99,36 @@ export ZSH=\"$ZSH\"
97 if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
98 # If this platform provides a "chsh" command (not Cygwin), do it, man!
99 if command_exists chsh; then
100- printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
101+ echo "${BLUE}Time to change your default shell to zsh!${NORMAL}"
102 chsh -s $(grep /zsh$ /etc/shells | tail -1)
103 # Else, suggest the user do so manually.
104 else