Update setup-min.sh

This commit is contained in:
AJ ONeal 2017-05-15 22:05:55 -06:00
parent 933ceba356
commit 0a5ec4deba
1 changed files with 13 additions and 10 deletions

View File

@ -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