From d2422a623a1fbb90b5152f422a7583d1ca852f87 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sun, 22 Dec 2013 18:23:59 +0100 Subject: [PATCH] made NVM_DIR and NVM_SOURCE configurable using environment variables --- install.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index a65db46..c69c149 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,13 @@ set -e -NVM_DIR="$HOME/.nvm" +if [ ! "$NVM_SOURCE" ]; then + NVM_SOURCE="https://github.com/creationix/nvm.git" +fi + +if [ ! "$NVM_DIR" ]; then + NVM_DIR="$HOME/.nvm" +fi if ! hash git 2>/dev/null; then echo >&2 "You need to install git - visit http://git-scm.com/downloads" @@ -12,11 +18,12 @@ fi if [ -d "$NVM_DIR" ]; then echo "=> NVM is already installed in $NVM_DIR, trying to update" - echo -ne "\r=> " - cd $NVM_DIR && git pull + echo -e "\r=> \c" + cd "$NVM_DIR" && git pull else # Cloning to $NVM_DIR - git clone https://github.com/creationix/nvm.git $NVM_DIR + mkdir -p "$NVM_DIR" + git clone "$NVM_SOURCE" "$NVM_DIR" fi echo