9cb14dc886696a0b53d18fea451dfba7d535c2b9

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #1085 from avit/install-path

Accept alternate install paths via ZSH variable

Diff

 1diff --git a/README.textile b/README.textile
 2index b80294c60f01a5df61c0d7c9fd158996b8d99a3e..c808fb5d706fb5e8760cba4b1c45ed14583e44bd 100644
 3--- a/README.textile
 4+++ b/README.textile
 5@@ -20,9 +20,19 @@ h4. via `wget`
 6 
 7 @wget --no-check-certificate http://install.ohmyz.sh -O - | sh@
 8 
 9-h3. The manual way
10+h4. Optional: change the install directory
11+
12+The default location is `~/.oh-my-zsh` (hidden in your home directory).
13+
14+You can change the install directory with the ZSH environment variable, either
15+by running `export ZSH=/your/path` before installing, or setting it before the
16+end of the install pipeline like this:
17+
18+@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh@
19 
20 
21+h3. The manual way
22+
23 1. Clone the repository
24 
25   @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
26@@ -35,7 +45,6 @@ h3. The manual way
27 
28   @cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
29 
30-
31 4. Set zsh as your default shell:
32 
33   @chsh -s /bin/zsh@
34@@ -46,6 +55,8 @@ h3. Problems?
35 
36 You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_.
37 
38+If you installed manually or changed the install location, check ZSH in ~/.zshrc
39+
40 h2. Usage
41 
42 * enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
43diff --git a/tools/install.sh b/tools/install.sh
44index b24bb4ad33fc4565b4316cb5d00b860090c4830e..343f251ae0d96adb6c9c17f423a13b553c231153 100755
45--- a/tools/install.sh
46+++ b/tools/install.sh
47@@ -1,16 +1,18 @@
48-ZSH=`/usr/bin/env|grep 'ZSH='|cut -d '=' -f 2`
49-if [ -d "$ZSH" ]
50+set -e
51+
52+if [ ! -n $ZSH ]
53 then
54-  echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
55-  exit
56-elif [ -d ~/.oh-my-zsh ]
57+  ZSH=~/.oh-my-zsh
58+fi
59+
60+if [ -d $ZSH ]
61 then
62-  echo "\033[0;33mYou already have One Oh My Zsh Directory.\033[0m You'll need to remove  ~/.oh-my-zsh if you want to clone"
63+  echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
64   exit
65 fi
66 
67 echo "\033[0;34mCloning Oh My Zsh...\033[0m"
68-hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || {
69+hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
70   echo "git not installed"
71   exit
72 }
73@@ -23,7 +25,10 @@ then
74 fi
75 
76 echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
77-cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
78+cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
79+sed -i -e "/^ZSH=/ c\\
80+ZSH=$ZSH
81+" ~/.zshrc
82 
83 echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
84 sed -i -e "/export PATH=/ c\\