From 40ab864ee80cb2ef364150e68884e8b2febc43d5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 28 Mar 2016 15:50:12 -0400 Subject: [PATCH] updating iojs -> node.js --- setup-min.sh | 42 ++++++++++------- ...avericks.bash => setup-node-mavericks.bash | 0 ...iojs-ubuntu.bash => setup-node-ubuntu.bash | 0 setup.bash | 45 ++++++++++--------- 4 files changed, 51 insertions(+), 36 deletions(-) rename setup-iojs-mavericks.bash => setup-node-mavericks.bash (100%) rename setup-iojs-ubuntu.bash => setup-node-ubuntu.bash (100%) diff --git a/setup-min.sh b/setup-min.sh index 546230e..0e6f39b 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -1,20 +1,20 @@ #!/bin/bash -# Installs iojs only (no development dependencies) for both Ubuntu and OS X +# Installs node.js only (no development dependencies) for both Ubuntu and OS X # -# See https://github.com/coolaj86/iojs-install-script +# See https://github.com/coolaj86/node-install-script # -# curl -fsSL bit.ly/iojs-min | bash -# wget -nv bit.ly/iojs-min -O - | bash +# curl -fsSL bit.ly/nodejs-min | bash +# wget -nv bit.ly/nodejs-min -O - | bash # curl -fsSL https://example.com/setup-min.bash | bash # wget -nv https://example.com/setup-min.bash -O - | bash NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" -BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" +BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" OS="unsupported" ARCH="" NODEJS_VER="" @@ -144,14 +144,24 @@ esac echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}" -if [ -n "$(which curl)" ]; then - curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -o /tmp/install-iojs.bash || echo 'error downloading os setup script' -elif [ -n "$(which wget)" ]; then - wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -O /tmp/install-iojs.bash || echo 'error downloading os setup script' -else - echo "Found neither 'curl' nor 'wget'. Can't Continue." +INSTALL_FILE="setup-node-${SETUP_FILE}.bash" +if [ ! -e "/tmp/${INSTALL_FILE}" ] +then + if [ -n "$(which curl)" ]; then + curl --silent "${BASE_URL}/${INSTALL_FILE}" \ + -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + elif [ -n "$(which wget)" ]; then + wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ + -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi +fi + +if [ ! -e "/tmp/${INSTALL_FILE}" ] +then + echo "Error Downloading Install File" exit 1 fi @@ -178,10 +188,10 @@ fi if [ -z "$NODEJS_VER" ]; then if [ -n "$(which curl)" ]; then - NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER=$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - NODEJS_VER="$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1) \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." @@ -227,7 +237,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then fi if [ -n "${NODEJS_VER}" ]; then - bash /tmp/install-iojs.bash "${NODEJS_VER}" + bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" fi echo "" diff --git a/setup-iojs-mavericks.bash b/setup-node-mavericks.bash similarity index 100% rename from setup-iojs-mavericks.bash rename to setup-node-mavericks.bash diff --git a/setup-iojs-ubuntu.bash b/setup-node-ubuntu.bash similarity index 100% rename from setup-iojs-ubuntu.bash rename to setup-node-ubuntu.bash diff --git a/setup.bash b/setup.bash index cc5bcd1..21237c2 100644 --- a/setup.bash +++ b/setup.bash @@ -1,6 +1,6 @@ #!/bin/bash -# Installs iojs + dependencies for both Ubuntu and OS X +# Installs node.js + dependencies for both Ubuntu and OS X # # See https://github.com/coolaj86/iojs-install-script @@ -147,19 +147,24 @@ esac echo "Preparing to install ${NODEJS_NAME} (and common development dependencies) for ${OS}" "${ARCH}" -if [ -n "$(which curl)" ]; then - curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ - -o /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' - curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -o /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' -elif [ -n "$(which wget)" ]; then - wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ - -O /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' - wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -O /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' -else - echo "Found neither 'curl' nor 'wget'. Can't Continue." - exit 1 +INSTALL_DEPS_FILE="setup-deps-${SETUP_FILE}.bash" +INSTALL_FILE="setup-node-${SETUP_FILE}.bash" +if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] +then + if [ -n "$(which curl)" ]; then + curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \ + -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script' + curl --silent "${BASE_URL}/${INSTALL_FILE}" \ + -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + elif [ -n "$(which wget)" ]; then + wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \ + -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script' + wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ + -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi fi @@ -203,7 +208,7 @@ if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then fi fi -bash /tmp/install-${NODEJS_NAME}-deps.bash "${NO_FAIL2BAN}" +bash "/tmp/${INSTALL_DEPS_FILE}" "${NO_FAIL2BAN}" ######################### # Which node.js VERSION ? # @@ -228,11 +233,11 @@ fi if [ -z "$NODEJS_VER" ]; then if [ -n "$(which curl)" ]; then - NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ - || echo 'error automatically determining current ${NODEJS_NAME} version' + NODEJS_VER=$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ + || echo "error automatically determining current ${NODEJS_NAME} version" elif [ -n "$(which wget)" ]; then - NODEJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ - || echo 'error automatically determining current ${NODEJS_NAME} version' + NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1) \ + || echo "error automatically determining current ${NODEJS_NAME} version" else echo "Found neither 'curl' nor 'wget'. Can't Continue." exit 1 @@ -276,7 +281,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then fi if [ -n "${NODEJS_VER}" ]; then - bash /tmp/install-${NODEJS_NAME}.bash "${NODEJS_VER}" + bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" fi # jshint