From 3c2c7fd0941e206ac799b21a6c2c43a312ee754c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 12:00:11 -0700 Subject: [PATCH] check for existing node version --- setup-mavericks.bash | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/setup-mavericks.bash b/setup-mavericks.bash index 2a0ed99..676f322 100644 --- a/setup-mavericks.bash +++ b/setup-mavericks.bash @@ -70,10 +70,22 @@ else fi # node -CUR_NODE_VER=$(node -v 2>/dev/null) -if [ -n "$(which node | grep node)" ] && [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then - echo node ${NODE_VER} already installed -else +if [ -n "$(which node | grep node 2>/dev/null)" ]; then + NODE_VER="" + + if [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then + echo node ${NODE_VER} already installed + else + echo "" + echo "HEY, LISTEN:" + echo "node is already installed as $(node -v | grep v)" + echo "" + echo "to reinstall please first run: rm $(which node)" + echo "" + fi +fi + +if [ -n "${NODE_VER}" ]; then echo "installing node ${NODE_VER}..." curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}.pkg" -o "/tmp/node-${NODE_VER}.pkg" sudo /usr/sbin/installer -pkg "/tmp/node-${NODE_VER}.pkg" -target /