mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 22:31:51 +00:00
Merge 5e8e37a85d
into 6c3708d337
This commit is contained in:
commit
88e02ef30b
16
install.sh
16
install.sh
@ -9,10 +9,16 @@ if [ -d "$NVM_TARGET" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Cloning to $NVM_TARGET
|
||||
git clone git://github.com/creationix/nvm.git $NVM_TARGET
|
||||
# Allow for alternate NVM sources so we can use a local copy or a fork
|
||||
if [ ! -d "$NVM_GIT_SOURCE" ]; then
|
||||
export NVM_GIT_SOURCE="git://github.com/creationix/nvm.git"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
# Cloning to $NVM_TARGET
|
||||
git clone $NVM_GIT_SOURCE $NVM_TARGET
|
||||
|
||||
echo
|
||||
|
||||
# Detect profile file, .bash_profile has precedence over .profile
|
||||
if [ ! -z "$1" ]; then
|
||||
@ -28,7 +34,7 @@ fi
|
||||
SOURCE_STR="[[ -s "$NVM_TARGET/nvm.sh" ]] && . "$NVM_TARGET/nvm.sh" # This loads NVM"
|
||||
|
||||
if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
||||
if [ -z $PROFILE ]; then
|
||||
if [ -z $PROFILE ]; then
|
||||
echo "=> Profile not found"
|
||||
else
|
||||
echo "=> Profile $PROFILE not found"
|
||||
@ -36,7 +42,7 @@ if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then
|
||||
echo "=> Append the following line to the correct file yourself"
|
||||
echo
|
||||
echo -e "\t$SOURCE_STR"
|
||||
echo
|
||||
echo
|
||||
echo "=> Close and reopen your terminal to start using NVM"
|
||||
exit
|
||||
fi
|
||||
|
20
nvm.sh
20
nvm.sh
@ -10,6 +10,10 @@ if [ ! -d "$NVM_DIR" ]; then
|
||||
export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}) && pwd)
|
||||
fi
|
||||
|
||||
if [ ! -d "$NODEJS_MIRROR" ]; then
|
||||
export NODEJS_MIRROR="http://nodejs.org/"
|
||||
fi
|
||||
|
||||
# Make zsh glob matching behave same as bash
|
||||
# This fixes the "zsh: no matches found" errors
|
||||
if [ ! -z "$(which unsetopt 2>/dev/null)" ]; then
|
||||
@ -90,7 +94,7 @@ nvm_ls_remote()
|
||||
else
|
||||
PATTERN=".*"
|
||||
fi
|
||||
VERSIONS=`curl -s http://nodejs.org/dist/ \
|
||||
VERSIONS=`curl -s $NODEJS_MIRROR/dist/ \
|
||||
| egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' \
|
||||
| grep -w "${PATTERN}" \
|
||||
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
||||
@ -242,8 +246,8 @@ nvm()
|
||||
esac
|
||||
if [ $binavail -eq 1 ]; then
|
||||
t="$VERSION-$os-$arch"
|
||||
url="http://nodejs.org/dist/$VERSION/node-${t}.tar.gz"
|
||||
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-${t}.tar.gz | awk '{print $1}'`
|
||||
url="$NODEJS_MIRROR/dist/$VERSION/node-${t}.tar.gz"
|
||||
sum=`curl -s $NODEJS_MIRROR/dist/$VERSION/SHASUMS.txt | grep node-${t}.tar.gz | awk '{print $1}'`
|
||||
if (
|
||||
mkdir -p "$NVM_DIR/bin/node-${t}" && \
|
||||
cd "$NVM_DIR/bin" && \
|
||||
@ -272,11 +276,11 @@ nvm()
|
||||
if [ "$os" = "freebsd" ]; then
|
||||
make='gmake'
|
||||
fi
|
||||
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"
|
||||
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-$VERSION.tar.gz | awk '{print $1}'`
|
||||
elif [ "`curl -Is "http://nodejs.org/dist/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
||||
tarball="http://nodejs.org/dist/node-$VERSION.tar.gz"
|
||||
if [ "`curl -Is "$NODEJS_MIRROR/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
||||
tarball="$NODEJS_MIRROR/dist/$VERSION/node-$VERSION.tar.gz"
|
||||
sum=`curl -s $NODEJS_MIRROR/dist/$VERSION/SHASUMS.txt | grep node-$VERSION.tar.gz | awk '{print $1}'`
|
||||
elif [ "`curl -Is "$NODEJS_MIRROR/dist/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
||||
tarball="$NODEJS_MIRROR/dist/node-$VERSION.tar.gz"
|
||||
fi
|
||||
if (
|
||||
[ ! -z $tarball ] && \
|
||||
|
Loading…
Reference in New Issue
Block a user