forked from coolaj86/node-installer.sh
updating iojs -> node.js
This commit is contained in:
parent
cfcb236d39
commit
40ab864ee8
42
setup-min.sh
42
setup-min.sh
|
@ -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,14 +144,24 @@ 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}"
|
||||||
|
|
||||||
if [ -n "$(which curl)" ]; then
|
INSTALL_FILE="setup-node-${SETUP_FILE}.bash"
|
||||||
curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \
|
if [ ! -e "/tmp/${INSTALL_FILE}" ]
|
||||||
-o /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
then
|
||||||
elif [ -n "$(which wget)" ]; then
|
if [ -n "$(which curl)" ]; then
|
||||||
wget --quiet "${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'
|
||||||
else
|
elif [ -n "$(which wget)" ]; then
|
||||||
echo "Found neither 'curl' nor 'wget'. Can't Continue."
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -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 ""
|
||||||
|
|
45
setup.bash
45
setup.bash
|
@ -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,19 +147,24 @@ 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}"
|
||||||
|
|
||||||
if [ -n "$(which curl)" ]; then
|
INSTALL_DEPS_FILE="setup-deps-${SETUP_FILE}.bash"
|
||||||
curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \
|
INSTALL_FILE="setup-node-${SETUP_FILE}.bash"
|
||||||
-o /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script'
|
if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ]
|
||||||
curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \
|
then
|
||||||
-o /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script'
|
if [ -n "$(which curl)" ]; then
|
||||||
elif [ -n "$(which wget)" ]; then
|
curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \
|
||||||
wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \
|
-o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script'
|
||||||
-O /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script'
|
curl --silent "${BASE_URL}/${INSTALL_FILE}" \
|
||||||
wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \
|
-o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
|
||||||
-O /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script'
|
elif [ -n "$(which wget)" ]; then
|
||||||
else
|
wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \
|
||||||
echo "Found neither 'curl' nor 'wget'. Can't Continue."
|
-O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script'
|
||||||
exit 1
|
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
|
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
|
||||||
|
|
Loading…
Reference in New Issue