From 2adfec1fd6bc7218082ab88e0b56556e81f98238 Mon Sep 17 00:00:00 2001 From: coolaj86 Date: Sun, 29 Oct 2017 03:41:44 +0000 Subject: [PATCH 1/9] Update 'README.md' --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5d74d16..ee02527 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Easy Install node.js +| Sponsored by [Daplie](https://daplie.com) | Automated node.js installers for OS X and Ubuntu From 4090196e8413fb16310f05fa93dc0ec337504ec4 Mon Sep 17 00:00:00 2001 From: coolaj86 Date: Thu, 2 Nov 2017 04:19:58 +0000 Subject: [PATCH 2/9] add -L to curl --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index b4dd539..6c336ae 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -23,7 +23,7 @@ INSTALL_FILE="node.setup.bash" if [ ! -e "/tmp/${INSTALL_FILE}" ] then if [ -n "$(which curl)" ]; then - curl --silent "${BASE_URL}/${INSTALL_FILE_REMOTE}" \ + curl --silent -L "${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}" \ From 32839e69baed8b167713f67f0d9574ea7aee56ad Mon Sep 17 00:00:00 2001 From: coolaj86 Date: Thu, 2 Nov 2017 04:20:56 +0000 Subject: [PATCH 3/9] add -L to curl to follow redirects --- setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index 0808440..b053776 100644 --- a/setup.bash +++ b/setup.bash @@ -173,7 +173,7 @@ INSTALL_DEPS_FILE="setup-deps-${SETUP_FILE}.bash" INSTALL_FILE="setup-node-${SETUP_FILE}.bash" if [ ! -e "/tmp/${INSTALL_FILE}" ]; then if [ -n "$(type -p curl)" ]; then - curl --silent "${BASE_URL}/${INSTALL_FILE}" \ + curl --silent -L "${BASE_URL}/${INSTALL_FILE}" \ -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' elif [ -n "$(type -p wget)" ]; then wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ @@ -187,7 +187,7 @@ fi if [ -z "$dont_install_deps" ]; then if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ]; then if [ -n "$(type -p curl)" ]; then - curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \ + curl --silent -L "${BASE_URL}/${INSTALL_DEPS_FILE}" \ -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" elif [ -n "$(type -p wget)" ]; then wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \ From 963f551a98f8100e2ab2ba7dda28189bf5faaa7f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 Nov 2017 14:31:34 -0600 Subject: [PATCH 4/9] update urls --- setup-min.sh | 4 ++-- setup.bash | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup-min.sh b/setup-min.sh index 6c336ae..a19f3e6 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -3,7 +3,7 @@ # Installs node.js + dependencies for both Ubuntu and OS X # -# See https://git.daplie.com/coolaj86/node-install-script +# See https://git.colaj86.com/coolaj86/node-installer.sh # # curl -fsSL https://example.com/setup.bash | bash @@ -12,7 +12,7 @@ set -e set -u -BASE_URL="https://git.daplie.com/coolaj86/node-install-script/raw/master" +BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master" ####################### # Download installers # diff --git a/setup.bash b/setup.bash index b053776..870b6b8 100644 --- a/setup.bash +++ b/setup.bash @@ -3,7 +3,7 @@ # Installs node.js only (no development dependencies) for both Ubuntu and OS X # -# See https://git.daplie.com/coolaj86/node-install-script +# See https://git.coolaj86.com/coolaj86/node-installer.sh # # curl -fsSL bit.ly/nodejs-min | bash @@ -23,7 +23,7 @@ fi NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" -BASE_URL="https://git.daplie.com/coolaj86/node-install-script/raw/master" +BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master" #NO_FAIL2BAN="" NO_FAIL2BAN="nope" OS="unsupported" From bacd1a4537224e8b13e2f5a353ab300a2426478f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 Nov 2017 14:32:42 -0600 Subject: [PATCH 5/9] rename setup.bash -> install.sh --- setup.bash => install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename setup.bash => install.sh (100%) diff --git a/setup.bash b/install.sh similarity index 100% rename from setup.bash rename to install.sh From b0b829fd91ec811af4d6022e91e5fa47b10e132c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 Nov 2017 14:51:47 -0600 Subject: [PATCH 6/9] update urls --- README.md | 20 ++++++++++++-------- install.sh | 10 +++++----- setup-min.sh | 4 ++-- setup.bash | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 setup.bash diff --git a/README.md b/README.md index ee02527..a2a6563 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Easy Install node.js + | Sponsored by [Daplie](https://daplie.com) | Automated node.js installers for OS X and Ubuntu @@ -7,10 +8,10 @@ Automated node.js installers for OS X and Ubuntu ```bash # install node.js without development dependencies -curl -fsSL bit.ly/install-min-node | bash +curl -fsSL bit.ly/node-installer | bash -s --no-dev-deps # using wget instead of curl (Ubuntu) -wget -nv bit.ly/install-min-node -O - | bash +wget -nv bit.ly/node-installer -O - | bash -s --no-dev-deps ``` **node.js + dev tools** @@ -18,10 +19,13 @@ wget -nv bit.ly/install-min-node -O - | bash Install node.js and basic development tools - git, node, gcc, pkg-config, etc ```bash -curl -L bit.ly/install-dev-node -o ./node-dev; bash ./node-dev +curl -fsSL bit.ly/node-installer -o ./node-installer.sh; bash ./node-installer.sh --dev-deps + +# or wget +wget -nv bit.ly/node-installer -O - ./node-installer.sh; bash ./node-installer.sh --dev-deps ``` - +*Note*: [bit.ly/node-installer](https://bit.ly/node-installer) simple redirects to ## Screencast @@ -35,8 +39,8 @@ echo "Current node.js version is $(curl -fsSL https://nodejs.org/dist/index.tab ```bash # To install a specific version rather than defaulting to latest -# latest version at time of writing are v4.4.1 and v5.9.1 -echo "v7.9.0" > /tmp/NODEJS_VER +# latest version at time of writing are v8.9.0 and v9.0.0 +echo "v8.9.0" > /tmp/NODEJS_VER ``` ## Notes @@ -66,7 +70,7 @@ Type `agree` and hit enter to accept the license. Now you can install node.js ```bash -curl -fsSL bit.ly/install-dev-node -o /tmp/node-dev.sh; bash /tmp/node-dev.sh +curl -fsSL bit.ly/node-installer -o /tmp/node-installer.sh; bash /tmp/node-installer.sh --dev-deps ``` *TODO*: Make it easier to accepting the license (automatic?) @@ -74,7 +78,7 @@ curl -fsSL bit.ly/install-dev-node -o /tmp/node-dev.sh; bash /tmp/node-dev.sh ### Ubuntu Linux ```bash -wget -nv bit.ly/install-dev-node -O /tmp/node-dev.sh; bash /tmp/node-dev.sh +wget -nv bit.ly/node-installer -O /tmp/node-installer.sh; bash /tmp/node-installer.sh --dev-deps ``` ### Other things you should know diff --git a/install.sh b/install.sh index 870b6b8..ee2dccb 100644 --- a/install.sh +++ b/install.sh @@ -12,7 +12,7 @@ # curl -fsSL https://example.com/setup-min.bash | bash # wget -nv https://example.com/setup-min.bash -O - | bash -dont_install_deps="$1" +deps_flag="$1" set -e set -u #set -o pipefail @@ -163,7 +163,7 @@ esac # Download installers # ####################### -if [ -z "$dont_install_deps" ]; then +if [ "--dev-deps" == "$deps_flag" ]; then echo "Preparing to install node.js (and common development dependencies) for ${OS}" "${ARCH}" else echo "Preparing to install node.js (minimal) for ${OS}" "${ARCH}" @@ -184,7 +184,7 @@ if [ ! -e "/tmp/${INSTALL_FILE}" ]; then fi fi -if [ -z "$dont_install_deps" ]; then +if [ "--dev-deps" == "$deps_flag" ]; then if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ]; then if [ -n "$(type -p curl)" ]; then curl --silent -L "${BASE_URL}/${INSTALL_DEPS_FILE}" \ @@ -205,7 +205,7 @@ then exit 1 fi -if [ -z "$dont_install_deps" ]; then +if [ "--dev-deps" == "$deps_flag" ]; then if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] then echo "Error Downloading Deps File" @@ -286,7 +286,7 @@ sudo chown -R $(whoami) $node_install_path/lib/node_modules echo "" -if [ -z "$dont_install_deps" ]; then +if [ "--dev-deps" == "$deps_flag" ]; then ################ # DEPENDENCIES # diff --git a/setup-min.sh b/setup-min.sh index a19f3e6..af68075 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -18,8 +18,8 @@ BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master" # Download installers # ####################### -INSTALL_FILE_REMOTE="setup.bash" -INSTALL_FILE="node.setup.bash" +INSTALL_FILE_REMOTE="install.sh" +INSTALL_FILE="node-installer.sh" if [ ! -e "/tmp/${INSTALL_FILE}" ] then if [ -n "$(which curl)" ]; then diff --git a/setup.bash b/setup.bash new file mode 100644 index 0000000..abd3ab1 --- /dev/null +++ b/setup.bash @@ -0,0 +1,44 @@ +#!/bin/bash + +# Installs node.js + dependencies for both Ubuntu and OS X + +# +# See https://git.colaj86.com/coolaj86/node-installer.sh +# + +# 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.coolaj86.com/coolaj86/node-installer.sh/raw/master" + +####################### +# Download installers # +####################### + +INSTALL_FILE_REMOTE="install.sh" +INSTALL_FILE="node-installer.sh" +if [ ! -e "/tmp/${INSTALL_FILE}" ] +then + if [ -n "$(which curl)" ]; then + curl --silent -L "${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}" From 65ad9460567b0fb074634460856cd917120d77de Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 Nov 2017 15:11:57 -0600 Subject: [PATCH 7/9] document install location env variable --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index a2a6563..5e7ce33 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,22 @@ echo "Current node.js version is $(curl -fsSL https://nodejs.org/dist/index.tab echo "v8.9.0" > /tmp/NODEJS_VER ``` +## Choosing an install location + +Just set BOTH `NODE_PATH` and `NPM_CONFIG_PREFIX`. +The install path will be the preceding `lib/node_modules` +(which you usually want to be the same as `NPM_CONFIG_PREFIIX` anyway). + +```bash +export NPM_CONFIG_PREFIX=/tmp/user/local +export NODE_PATH=/tmp/user/local/lib/node_modules + +curl -fsSL bit.ly/node-installer -o ./node-installer.sh; bash ./node-installer.sh --dev-deps + +# If you want to add the install location to your PATH +PATH=$PATH:/tmp/user/local/bin +``` + ## Notes * [OS X](#apple-os-x) From 216aa9b420b6499ddebe50e7f3b02551be3f12ba Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 Nov 2017 15:21:25 -0600 Subject: [PATCH 8/9] more helpful path output --- install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index ee2dccb..0e44e04 100644 --- a/install.sh +++ b/install.sh @@ -254,13 +254,15 @@ if [ -z "${NODE_PATH-}" ]; then if [ -n "$(type -p node | grep node 2>/dev/null)" ]; then # /usr/local/bin/node => /usr/local node_install_path="$(dirname $(dirname $(type -p node)))" + echo "NODE_PATH is not set. Using existing node install path: '$node_install_path'" else node_install_path=$PREFIX/usr/local + echo "NODE_PATH is not set. Using default install path '$node_install_path'" fi else node_install_path=$(dirname $(dirname $NODE_PATH)) + echo "NODE_PATH is '$NODE_PATH', so install path is '$node_install_path'" fi -echo "Install path is $node_install_path" if [ -e "$node_install_path/bin/node" ]; then # node of some version is already installed if [ "${NODEJS_VER}" == "$($node_install_path/bin/node -v 2>/dev/null)" ]; then From e57069fe5084920d2b3364392349f800a92f474e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 6 Nov 2017 13:17:09 -0700 Subject: [PATCH 9/9] rename for merge --- setup.bash => old.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename setup.bash => old.sh (100%) diff --git a/setup.bash b/old.sh similarity index 100% rename from setup.bash rename to old.sh