From 0787a55999b7dca9357ecec1b91b07f0c57f88f2 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sun, 22 Dec 2013 17:46:26 +0100 Subject: [PATCH] replaced fatalExit function for 'inline' exit exit on errors (set -e) simplified if for NVM_DIR and NVM_SOURCE, corrected indentation --- install-gitless.sh | 11 ++++++----- install.sh | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/install-gitless.sh b/install-gitless.sh index d4b96b4..6bdede1 100755 --- a/install-gitless.sh +++ b/install-gitless.sh @@ -1,15 +1,16 @@ #!/bin/bash +set -e + fatalExit (){ echo "$@" && exit 1; } -# an alternative URL that could be used: https://github.com/creationix/nvm/tarball/master -if [ "$NVM_SOURCE" = "" ]; then +if [ ! "$NVM_SOURCE" ]; then NVM_SOURCE="https://raw.github.com/creationix/nvm/master/nvm.sh" fi -if [ "$NVM_DIR" = "" ]; then +if [ ! "$NVM_DIR" ]; then NVM_DIR="$HOME/.nvm" fi @@ -20,9 +21,9 @@ echo -ne "=> Downloading... " # Detect if curl or wget is installed to download NVM_SOURCE if type curl > /dev/null 2>&1; then - curl --silent "$NVM_SOURCE" -o nvm.sh || fatalExit "Failed"; + curl --silent "$NVM_SOURCE" -o nvm.sh || fatalExit "Failed downloading $NVM_SOURCE"; elif type wget > /dev/null 2>&1; then - wget --quiet "$NVM_SOURCE" -O nvm.sh || fatalExit "Failed"; + wget --quiet "$NVM_SOURCE" -O nvm.sh || fatalExit "Failed downloading $NVM_SOURCE"; else fatalExit "Must have curl or wget to install nvm"; fi diff --git a/install.sh b/install.sh index e76fcd5..a65db46 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + NVM_DIR="$HOME/.nvm" if ! hash git 2>/dev/null; then