2015-01-20 00:06:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-05-25 21:08:33 +00:00
|
|
|
# Installs node.js + dependencies for both Ubuntu and OS X
|
2015-01-21 06:17:31 +00:00
|
|
|
|
|
|
|
#
|
2017-11-03 20:31:34 +00:00
|
|
|
# See https://git.colaj86.com/coolaj86/node-installer.sh
|
2015-01-21 06:17:31 +00:00
|
|
|
#
|
|
|
|
|
2017-05-25 21:08:33 +00:00
|
|
|
# curl -fsSL https://example.com/setup.bash | bash
|
|
|
|
# wget -nv https://example.com/setup.bash -O - | bash
|
2015-01-21 06:17:31 +00:00
|
|
|
|
2017-05-16 03:56:04 +00:00
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
2017-11-03 20:31:34 +00:00
|
|
|
BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master"
|
2015-01-21 06:17:31 +00:00
|
|
|
|
|
|
|
#######################
|
|
|
|
# Download installers #
|
|
|
|
#######################
|
|
|
|
|
2017-11-03 20:51:47 +00:00
|
|
|
INSTALL_FILE_REMOTE="install.sh"
|
|
|
|
INSTALL_FILE="node-installer.sh"
|
2016-03-28 19:50:12 +00:00
|
|
|
if [ ! -e "/tmp/${INSTALL_FILE}" ]
|
|
|
|
then
|
2017-05-25 21:08:33 +00:00
|
|
|
if [ -n "$(which curl)" ]; then
|
2017-11-02 04:19:58 +00:00
|
|
|
curl --silent -L "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
|
2017-05-25 21:08:33 +00:00
|
|
|
-o "/tmp/${INSTALL_FILE}" || echo 'error setup script: '"${BASE_URL}/${INSTALL_FILE_REMOTE}"
|
|
|
|
elif [ -n "$(which wget)" ]; then
|
|
|
|
wget --quiet "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
|
|
|
|
-O "/tmp/${INSTALL_FILE}" || echo 'error setup script: '"${BASE_URL}/${INSTALL_FILE_REMOTE}"
|
2016-03-28 19:50:12 +00:00
|
|
|
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"
|
2015-01-21 06:17:31 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-05-08 16:20:59 +00:00
|
|
|
|
2017-05-25 21:08:33 +00:00
|
|
|
bash "/tmp/${INSTALL_FILE}" --no-dev-deps
|