updating iojs -> node.js

This commit is contained in:
AJ ONeal 2016-03-28 15:50:12 -04:00
parent cfcb236d39
commit 40ab864ee8
4 changed files with 51 additions and 36 deletions

View File

@ -1,20 +1,20 @@
#!/bin/bash #!/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 # curl -fsSL bit.ly/nodejs-min | bash
# wget -nv bit.ly/iojs-min -O - | bash # wget -nv bit.ly/nodejs-min -O - | bash
# curl -fsSL https://example.com/setup-min.bash | bash # curl -fsSL https://example.com/setup-min.bash | bash
# wget -nv https://example.com/setup-min.bash -O - | bash # wget -nv https://example.com/setup-min.bash -O - | bash
NODEJS_NAME="node" NODEJS_NAME="node"
NODEJS_BASE_URL="https://nodejs.org" 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" OS="unsupported"
ARCH="" ARCH=""
NODEJS_VER="" NODEJS_VER=""
@ -144,16 +144,26 @@ esac
echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}" echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}"
INSTALL_FILE="setup-node-${SETUP_FILE}.bash"
if [ ! -e "/tmp/${INSTALL_FILE}" ]
then
if [ -n "$(which curl)" ]; then if [ -n "$(which curl)" ]; then
curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ curl --silent "${BASE_URL}/${INSTALL_FILE}" \
-o /tmp/install-iojs.bash || echo 'error downloading os setup script' -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
elif [ -n "$(which wget)" ]; then elif [ -n "$(which wget)" ]; then
wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ wget --quiet "${BASE_URL}/${INSTALL_FILE}" \
-O /tmp/install-iojs.bash || echo 'error downloading os setup script' -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
else else
echo "Found neither 'curl' nor 'wget'. Can't Continue." echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1 exit 1
fi fi
fi
if [ ! -e "/tmp/${INSTALL_FILE}" ]
then
echo "Error Downloading Install File"
exit 1
fi
######################### #########################
# Which io.js VERSION ? # # Which io.js VERSION ? #
@ -178,10 +188,10 @@ fi
if [ -z "$NODEJS_VER" ]; then if [ -z "$NODEJS_VER" ]; then
if [ -n "$(which curl)" ]; 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' || echo 'error automatically determining current io.js version'
elif [ -n "$(which wget)" ]; then 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' || echo 'error automatically determining current io.js version'
else else
echo "Found neither 'curl' nor 'wget'. Can't Continue." 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 fi
if [ -n "${NODEJS_VER}" ]; then if [ -n "${NODEJS_VER}" ]; then
bash /tmp/install-iojs.bash "${NODEJS_VER}" bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}"
fi fi
echo "" echo ""

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/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 # See https://github.com/coolaj86/iojs-install-script
@ -147,20 +147,25 @@ esac
echo "Preparing to install ${NODEJS_NAME} (and common development dependencies) for ${OS}" "${ARCH}" echo "Preparing to install ${NODEJS_NAME} (and common development dependencies) for ${OS}" "${ARCH}"
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 if [ -n "$(which curl)" ]; then
curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \
-o /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script'
curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ curl --silent "${BASE_URL}/${INSTALL_FILE}" \
-o /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
elif [ -n "$(which wget)" ]; then elif [ -n "$(which wget)" ]; then
wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \
-O /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script'
wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ wget --quiet "${BASE_URL}/${INSTALL_FILE}" \
-O /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
else else
echo "Found neither 'curl' nor 'wget'. Can't Continue." echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1 exit 1
fi fi
fi
@ -203,7 +208,7 @@ if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
fi fi
fi fi
bash /tmp/install-${NODEJS_NAME}-deps.bash "${NO_FAIL2BAN}" bash "/tmp/${INSTALL_DEPS_FILE}" "${NO_FAIL2BAN}"
######################### #########################
# Which node.js VERSION ? # # Which node.js VERSION ? #
@ -228,11 +233,11 @@ fi
if [ -z "$NODEJS_VER" ]; then if [ -z "$NODEJS_VER" ]; then
if [ -n "$(which curl)" ]; 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 ${NODEJS_NAME} version' || echo "error automatically determining current ${NODEJS_NAME} version"
elif [ -n "$(which wget)" ]; then 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 ${NODEJS_NAME} version' || echo "error automatically determining current ${NODEJS_NAME} version"
else else
echo "Found neither 'curl' nor 'wget'. Can't Continue." echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1 exit 1
@ -276,7 +281,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then
fi fi
if [ -n "${NODEJS_VER}" ]; then if [ -n "${NODEJS_VER}" ]; then
bash /tmp/install-${NODEJS_NAME}.bash "${NODEJS_VER}" bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}"
fi fi
# jshint # jshint