mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 14:51:49 +00:00
replaced fatalExit function for 'inline' exit
exit on errors (set -e) simplified if for NVM_DIR and NVM_SOURCE, corrected indentation
This commit is contained in:
parent
5c7996da5b
commit
0774058cf1
@ -1,23 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
function fatalExit (){
|
||||
echo "$@" && exit 1;
|
||||
}
|
||||
set -e
|
||||
|
||||
# an alternative URL that could be used: https://github.com/creationix/nvm/tarball/master
|
||||
if [ "$NVM_SOURCE" == "" ]; then
|
||||
NVM_SOURCE="https://raw.github.com/creationix/nvm/master/nvm.sh"
|
||||
if [ ! "$NVM_SOURCE" ]; then
|
||||
NVM_SOURCE="https://raw.github.com/creationix/nvm/master/nvm.sh"
|
||||
fi
|
||||
|
||||
if [ "$NVM_DIR" == "" ]; then
|
||||
NVM_DIR="$HOME/.nvm"
|
||||
if [ ! "$NVM_DIR" ]; then
|
||||
NVM_DIR="$HOME/.nvm"
|
||||
fi
|
||||
|
||||
# Downloading to $NVM_DIR
|
||||
mkdir -p "$NVM_DIR"
|
||||
pushd "$NVM_DIR" > /dev/null
|
||||
echo -ne "=> Downloading... "
|
||||
curl --silent "$NVM_SOURCE" -o nvm.sh || fatalExit "Failed";
|
||||
curl --silent "$NVM_SOURCE" -o nvm.sh || {
|
||||
echo "Failed downloading $NVM_SOURCE" && exit 1
|
||||
}
|
||||
echo "Downloaded"
|
||||
popd > /dev/null
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
NVM_DIR="$HOME/.nvm"
|
||||
|
||||
if ! hash git 2>/dev/null; then
|
||||
|
Loading…
Reference in New Issue
Block a user