Skip to content
Browse files

Accept alternate install paths via ZSH variable

Uses environment variable $ZSH to configure install location.
  • Loading branch information...
1 parent 1103421 commit 4766fc62899b98d7958c8c1d18d5dc40b3dc2eab @avit committed Apr 23, 2012
Showing with 21 additions and 5 deletions.
  1. +7 −1 README.textile
  2. +14 −4 tools/install.sh
View
8 README.textile
@@ -19,9 +19,15 @@ h4. via `wget`
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
-h3. The manual way
+h4. Install location
+
+You can change the install destination via the ZSH environment variable. The default location is `~/.oh-my-zsh`:
+
+@...install.sh | ZSH=~/.dotfiles sh@
+h3. The manual way
+
1. Clone the repository
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
View
18 tools/install.sh
@@ -1,11 +1,18 @@
-if [ -d ~/.oh-my-zsh ]
+set -e
+
+if [ ! -n $ZSH ]
+then
+ ZSH=~/.oh-my-zsh
+fi
+
+if [ -d $ZSH ]
then
- echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
+ echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
exit
fi
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
-hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || {
+hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
echo "git not installed"
exit
}
@@ -19,7 +26,10 @@ then
fi
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
-cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
+cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
+sed -i -e "/^ZSH=/ c\\
+ZSH=$ZSH
+" ~/.zshrc
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
echo "export PATH=$PATH" >> ~/.zshrc

0 comments on commit 4766fc6

Please sign in to comment.
Something went wrong with that request. Please try again.