node-installer.sh/setup-min.sh

45 lines
1.1 KiB
Bash

#!/bin/bash
# Installs node.js + dependencies for both Ubuntu and OS X
#
# See https://git.daplie.com/coolaj86/node-install-script
#
# curl -fsSL https://example.com/setup.bash | bash
# wget -nv https://example.com/setup.bash -O - | bash
set -e
set -u
BASE_URL="https://git.daplie.com/Daplie/node-install-script/raw/master"
#######################
# Download installers #
#######################
INSTALL_FILE_REMOTE="setup.bash"
INSTALL_FILE="node.setup.bash"
if [ ! -e "/tmp/${INSTALL_FILE}" ]
then
if [ -n "$(which curl)" ]; then
curl --silent "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
-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}"
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
bash "/tmp/${INSTALL_FILE}" --no-dev-deps