From 0a5ec4deba0dc22a6ee158a6b8c199afd6fec6ec Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 15 May 2017 22:05:55 -0600 Subject: [PATCH] Update setup-min.sh --- setup-min.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/setup-min.sh b/setup-min.sh index 9282c73..3f3f6db 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -14,18 +14,12 @@ set -e set -u -set -o pipefail +#set -o pipefail if [ -z "${PREFIX-}" ]; then PREFIX="" fi -if [ -z "${NODE_PATH-}" ]; then - node_install_path=$PREFIX/usr/local -else - node_install_path=$(dirname $(dirname $NODE_PATH)) -fi - NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" BASE_URL="https://git.daplie.com/coolaj86/node-install-script/raw/master" @@ -171,10 +165,10 @@ echo "Preparing to install node.js (and common development dependencies) for ${O INSTALL_FILE="setup-node-${SETUP_FILE}.bash" if [ ! -e "/tmp/${INSTALL_FILE}" ] then - if [ -n "$(which curl)" ]; then + if [ -n "$(type -p curl)" ]; then curl --silent "${BASE_URL}/${INSTALL_FILE}" \ -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' - elif [ -n "$(which wget)" ]; then + elif [ -n "$(type -p wget)" ]; then wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' else @@ -226,7 +220,16 @@ fi # # node # -if [ -n "$(which node | grep node 2>/dev/null)" ]; then +if [ -z "${NODE_PATH-}" ]; then + if [ -n "$(type -p node | grep node 2>/dev/null)" ]; then + node_install_path="$(type -p node)" + else + node_install_path=$PREFIX/usr/local + fi +else + node_install_path=$(dirname $(dirname $NODE_PATH)) +fi +if [ -e "$node_install_path/bin/node" ]; then # node of some version is already installed if [ "${NODEJS_VER}" == "$(node -v 2>/dev/null)" ]; then echo node ${NODEJS_VER} is already installed