made NVM_DIR and NVM_SOURCE configurable using environment variables
parent
fcc00b22b7
commit
d2422a623a
15
install.sh
15
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
|
||||
|
|
Loading…
Reference in New Issue