parent
3b2d2e4b61
commit
a1d14ea5b8
16
nvm.sh
16
nvm.sh
|
@ -107,6 +107,17 @@ nvm_ls_remote()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvm_checksum()
|
||||||
|
{
|
||||||
|
if [ "$1" = "$2" ]; then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo 'Checksums do not match.'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print_versions()
|
print_versions()
|
||||||
{
|
{
|
||||||
OUTPUT=''
|
OUTPUT=''
|
||||||
|
@ -186,10 +197,12 @@ nvm()
|
||||||
if [ $binavail -eq 1 ]; then
|
if [ $binavail -eq 1 ]; then
|
||||||
t="$VERSION-$os-$arch"
|
t="$VERSION-$os-$arch"
|
||||||
url="http://nodejs.org/dist/$VERSION/node-${t}.tar.gz"
|
url="http://nodejs.org/dist/$VERSION/node-${t}.tar.gz"
|
||||||
|
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt.asc | grep node-${t}.tar.gz | awk '{print $1}'`
|
||||||
if (
|
if (
|
||||||
mkdir -p "$NVM_DIR/bin/node-${t}" && \
|
mkdir -p "$NVM_DIR/bin/node-${t}" && \
|
||||||
cd "$NVM_DIR/bin" && \
|
cd "$NVM_DIR/bin" && \
|
||||||
curl -C - --progress-bar $url -o "node-${t}.tar.gz" && \
|
curl -C - --progress-bar $url -o "node-${t}.tar.gz" && \
|
||||||
|
nvm_checksum `shasum node-${t}.tar.gz | awk '{print $1}'` $sum && \
|
||||||
tar -xzf "node-${t}.tar.gz" -C "node-${t}" --strip-components 1 && \
|
tar -xzf "node-${t}.tar.gz" -C "node-${t}" --strip-components 1 && \
|
||||||
mv "node-${t}" "../$VERSION" && \
|
mv "node-${t}" "../$VERSION" && \
|
||||||
rm -f "node-${t}.tar.gz"
|
rm -f "node-${t}.tar.gz"
|
||||||
|
@ -207,8 +220,10 @@ nvm()
|
||||||
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
|
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
|
||||||
|
|
||||||
tarball=''
|
tarball=''
|
||||||
|
sum=''
|
||||||
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}'`
|
||||||
elif [ "`curl -Is "http://nodejs.org/dist/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
elif [ "`curl -Is "http://nodejs.org/dist/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
||||||
tarball="http://nodejs.org/dist/node-$VERSION.tar.gz"
|
tarball="http://nodejs.org/dist/node-$VERSION.tar.gz"
|
||||||
fi
|
fi
|
||||||
|
@ -217,6 +232,7 @@ nvm()
|
||||||
mkdir -p "$NVM_DIR/src" && \
|
mkdir -p "$NVM_DIR/src" && \
|
||||||
cd "$NVM_DIR/src" && \
|
cd "$NVM_DIR/src" && \
|
||||||
curl --progress-bar $tarball -o "node-$VERSION.tar.gz" && \
|
curl --progress-bar $tarball -o "node-$VERSION.tar.gz" && \
|
||||||
|
if [ "$sum" = "" ]; then return 0; else nvm_checksum `shasum node-$VERSION.tar.gz | awk '{print $1}'` $sum; fi && \
|
||||||
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 && \
|
||||||
|
|
Loading…
Reference in New Issue