mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 18:25:52 +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 | ||||
|  | ||||
| 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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user