Merge pull request #277 from frasertweedale/fix/freebsd-sha1
support FreeBSD's sha1(1) for integrity checksmaster
commit
dc53a37d4f
19
nvm.sh
19
nvm.sh
|
@ -125,7 +125,15 @@ nvm_ls_remote() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_checksum() {
|
nvm_checksum() {
|
||||||
if [ "$1" = "$2" ]; then
|
if which shasum >/dev/null 2>&1; then
|
||||||
|
checksum=$(shasum $1 | awk '{print $1}')
|
||||||
|
elif which sha1 >/dev/null 2>&1; then
|
||||||
|
checksum=$(sha1 -q $1)
|
||||||
|
else
|
||||||
|
checksum=$(sha1sum $1 | awk '{print $1}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$checksum" = "$2" ]; then
|
||||||
return
|
return
|
||||||
elif [ -z $2 ]; then
|
elif [ -z $2 ]; then
|
||||||
echo 'Checksums empty' #missing in raspberry pi binary
|
echo 'Checksums empty' #missing in raspberry pi binary
|
||||||
|
@ -220,17 +228,12 @@ nvm() {
|
||||||
local url
|
local url
|
||||||
local sum
|
local sum
|
||||||
local tarball
|
local tarball
|
||||||
local shasum='shasum'
|
|
||||||
local nobinary
|
local nobinary
|
||||||
|
|
||||||
if ! has "curl"; then
|
if ! has "curl"; then
|
||||||
echo 'NVM Needs curl to proceed.' >&2;
|
echo 'NVM Needs curl to proceed.' >&2;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! has "shasum"; then
|
|
||||||
shasum='sha1sum'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
nvm help
|
nvm help
|
||||||
return
|
return
|
||||||
|
@ -283,7 +286,7 @@ nvm() {
|
||||||
if (
|
if (
|
||||||
mkdir -p "$tmpdir" && \
|
mkdir -p "$tmpdir" && \
|
||||||
curl -L -C - --progress-bar $url -o "$tmptarball" && \
|
curl -L -C - --progress-bar $url -o "$tmptarball" && \
|
||||||
nvm_checksum `${shasum} "$tmptarball" | awk '{print $1}'` $sum && \
|
nvm_checksum "$tmptarball" $sum && \
|
||||||
tar -xzf "$tmptarball" -C "$tmpdir" --strip-components 1 && \
|
tar -xzf "$tmptarball" -C "$tmpdir" --strip-components 1 && \
|
||||||
rm -f "$tmptarball" && \
|
rm -f "$tmptarball" && \
|
||||||
mv "$tmpdir" "$NVM_DIR/$VERSION"
|
mv "$tmpdir" "$NVM_DIR/$VERSION"
|
||||||
|
@ -319,7 +322,7 @@ nvm() {
|
||||||
[ ! -z $tarball ] && \
|
[ ! -z $tarball ] && \
|
||||||
mkdir -p "$tmpdir" && \
|
mkdir -p "$tmpdir" && \
|
||||||
curl -L --progress-bar $tarball -o "$tmptarball" && \
|
curl -L --progress-bar $tarball -o "$tmptarball" && \
|
||||||
if [ "$sum" = "" ]; then : ; else nvm_checksum `${shasum} "$tmptarball" | awk '{print $1}'` $sum; fi && \
|
nvm_checksum "$tmptarball" $sum && \
|
||||||
tar -xzf "$tmptarball" -C "$tmpdir" && \
|
tar -xzf "$tmptarball" -C "$tmpdir" && \
|
||||||
cd "$tmpdir/node-$VERSION" && \
|
cd "$tmpdir/node-$VERSION" && \
|
||||||
./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \
|
./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \
|
||||||
|
|
Loading…
Reference in New Issue