mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-11-01 02:35:51 +08:00 
			
		
		
		
	made NVM_DIR and NVM_SOURCE configurable using environment variables
This commit is contained in:
		
							
								
								
									
										15
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								install.sh
									
									
									
									
									
								
							| @@ -2,7 +2,13 @@ | |||||||
|  |  | ||||||
| set -e | 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 | if ! hash git 2>/dev/null; then | ||||||
|   echo >&2 "You need to install git - visit http://git-scm.com/downloads" |   echo >&2 "You need to install git - visit http://git-scm.com/downloads" | ||||||
| @@ -12,11 +18,12 @@ fi | |||||||
|  |  | ||||||
| if [ -d "$NVM_DIR" ]; then | if [ -d "$NVM_DIR" ]; then | ||||||
|   echo "=> NVM is already installed in $NVM_DIR, trying to update" |   echo "=> NVM is already installed in $NVM_DIR, trying to update" | ||||||
|   echo -ne "\r=> " |   echo -e "\r=> \c" | ||||||
|   cd $NVM_DIR && git pull |   cd "$NVM_DIR" && git pull | ||||||
| else | else | ||||||
|   # Cloning to $NVM_DIR |   # 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 | fi | ||||||
|  |  | ||||||
| echo | echo | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user