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}"