mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-11-01 02:35:51 +08:00 
			
		
		
		
	Add FreeBSD support
This commit is contained in:
		
							
								
								
									
										13
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -142,6 +142,7 @@ nvm() | |||||||
|     Linux\ *) os=linux ;; |     Linux\ *) os=linux ;; | ||||||
|     Darwin\ *) os=darwin ;; |     Darwin\ *) os=darwin ;; | ||||||
|     SunOS\ *) os=sunos ;; |     SunOS\ *) os=sunos ;; | ||||||
|  |     FreeBSD\ *) os=freebsd ;; | ||||||
|   esac |   esac | ||||||
|   case "$uname" in |   case "$uname" in | ||||||
|     *x86_64*) arch=x64 ;; |     *x86_64*) arch=x64 ;; | ||||||
| @@ -211,6 +212,10 @@ nvm() | |||||||
|         shift |         shift | ||||||
|       fi |       fi | ||||||
|  |  | ||||||
|  |       if [ "$os" = "freebsd" ]; then | ||||||
|  | 	nobinary=1 | ||||||
|  |       fi | ||||||
|  |  | ||||||
|       VERSION=`nvm_remote_version $1` |       VERSION=`nvm_remote_version $1` | ||||||
|       ADDITIONAL_PARAMETERS='' |       ADDITIONAL_PARAMETERS='' | ||||||
|  |  | ||||||
| @@ -263,6 +268,10 @@ nvm() | |||||||
|  |  | ||||||
|       tarball='' |       tarball='' | ||||||
|       sum='' |       sum='' | ||||||
|  |       make='make' | ||||||
|  |       if [ "$os" = "freebsd" ]; then | ||||||
|  | 	make='gmake' | ||||||
|  |       fi | ||||||
|       if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then |       if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then | ||||||
|         tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" |         tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | ||||||
|         sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-$VERSION.tar.gz | awk '{print $1}'` |         sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-$VERSION.tar.gz | awk '{print $1}'` | ||||||
| @@ -278,9 +287,9 @@ nvm() | |||||||
|         tar -xzf "node-$VERSION.tar.gz" && \ |         tar -xzf "node-$VERSION.tar.gz" && \ | ||||||
|         cd "node-$VERSION" && \ |         cd "node-$VERSION" && \ | ||||||
|         ./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \ |         ./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \ | ||||||
|         make && \ |         $make && \ | ||||||
|         rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \ |         rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \ | ||||||
|         make install |         $make install | ||||||
|         ) |         ) | ||||||
|       then |       then | ||||||
|         nvm use $VERSION |         nvm use $VERSION | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user