Update setup-min.sh
This commit is contained in:
parent
933ceba356
commit
0a5ec4deba
23
setup-min.sh
23
setup-min.sh
|
@ -14,18 +14,12 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -u
|
set -u
|
||||||
set -o pipefail
|
#set -o pipefail
|
||||||
|
|
||||||
if [ -z "${PREFIX-}" ]; then
|
if [ -z "${PREFIX-}" ]; then
|
||||||
PREFIX=""
|
PREFIX=""
|
||||||
fi
|
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_NAME="node"
|
||||||
NODEJS_BASE_URL="https://nodejs.org"
|
NODEJS_BASE_URL="https://nodejs.org"
|
||||||
BASE_URL="https://git.daplie.com/coolaj86/node-install-script/raw/master"
|
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"
|
INSTALL_FILE="setup-node-${SETUP_FILE}.bash"
|
||||||
if [ ! -e "/tmp/${INSTALL_FILE}" ]
|
if [ ! -e "/tmp/${INSTALL_FILE}" ]
|
||||||
then
|
then
|
||||||
if [ -n "$(which curl)" ]; then
|
if [ -n "$(type -p curl)" ]; then
|
||||||
curl --silent "${BASE_URL}/${INSTALL_FILE}" \
|
curl --silent "${BASE_URL}/${INSTALL_FILE}" \
|
||||||
-o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
|
-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}" \
|
wget --quiet "${BASE_URL}/${INSTALL_FILE}" \
|
||||||
-O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
|
-O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
|
||||||
else
|
else
|
||||||
|
@ -226,7 +220,16 @@ fi
|
||||||
#
|
#
|
||||||
# node
|
# 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
|
# node of some version is already installed
|
||||||
if [ "${NODEJS_VER}" == "$(node -v 2>/dev/null)" ]; then
|
if [ "${NODEJS_VER}" == "$(node -v 2>/dev/null)" ]; then
|
||||||
echo node ${NODEJS_VER} is already installed
|
echo node ${NODEJS_VER} is already installed
|
||||||
|
|
Loading…
Reference in New Issue