From de522df09b5681eca25a37d19a39f9a5658b77a3 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Fri, 1 Sep 2017 20:09:55 -0600 Subject: [PATCH 01/19] Update setup-node-ubuntu.bash to allow for `Marvell` OS. This is for our development purposes. In the future, we will have a fully custom image with the name containing `Daplie` --- setup-node-ubuntu.bash | 377 +++++++++++++++++++++++++++++++++++------ 1 file changed, 329 insertions(+), 48 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 7b80775..6b7afc2 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -1,69 +1,350 @@ #!/bin/bash +# Installs node.js only (no development dependencies) for both Ubuntu and OS X + +# +# See https://git.daplie.com/coolaj86/node-install-script +# + +# curl -fsSL bit.ly/nodejs-min | bash +# wget -nv bit.ly/nodejs-min -O - | bash + +# curl -fsSL https://example.com/setup-min.bash | bash +# wget -nv https://example.com/setup-min.bash -O - | bash + +dont_install_deps="$1" set -e set -u -set -o pipefail +#set -o pipefail if [ -z "${PREFIX-}" ]; then PREFIX="" fi -if [ -z "${NODE_PATH-}" ]; then - node_install_path=$PREFIX/usr/local -else - node_install_path=$(dirname $(dirname $NODE_PATH)) -fi - -NODEJS_VER=${1} -NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) - NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" +BASE_URL="https://git.daplie.com/coolaj86/node-install-script/raw/master" +#NO_FAIL2BAN="" +NO_FAIL2BAN="nope" +OS="unsupported" +ARCH="" +NODEJS_VER="" +SETUP_FILE="" -if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] -then - echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" - NODEJS_BASE_URL="https://iojs.org" - NODEJS_NAME="iojs" -fi +clear -if [ -n "$(arch | grep aarch64)" ]; then - ARCH="arm64" -elif [ -n "$(arch | grep 64)" ]; then - ARCH="x64" -elif [ -n "$(arch | grep armv8l)" ]; then - ARCH="arm64" -elif [ -n "$(arch | grep armv7l)" ]; then - ARCH="armv7l" -elif [ -n "$(arch | grep armv6l)" ]; then - ARCH="armv6l" -else - ARCH="x86" -fi +######################### +# Which OS and version? # +######################### -NODEJS_REMOTE="${NODEJS_BASE_URL}/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz" -NODEJS_LOCAL="/tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz" -NODEJS_UNTAR="/tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}" +if [ "$(uname | grep -i 'Darwin')" ]; then + OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)" + OSX_MAJOR="$(echo ${OSX_VER} | cut -d'.' -f1)" + OSX_MINOR="$(echo ${OSX_VER} | cut -d'.' -f2)" + OSX_PATCH="$(echo ${OSX_VER} | cut -d'.' -f3)" -if [ -n "${NODEJS_VER}" ]; then - echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..." - - if [ -n "$(which curl 2>/dev/null)" ]; then - curl -fsSL ${NODEJS_REMOTE} -o ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' - elif [ -n "$(which wget 2>/dev/null)" ]; then - wget --quiet ${NODEJS_REMOTE} -O ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' - else - echo "'wget' and 'curl' are missing. Please run the following command and try again" - echo "\tsudo apt-get install --yes curl wget" + # + # Major + # + if [ "$OSX_MAJOR" -lt 10 ]; then + echo "unsupported OS X version (os 9-)" exit 1 fi - mkdir -p ${NODEJS_UNTAR}/ - tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ --strip-components=1 - rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} - sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + if [ "$OSX_MAJOR" -gt 10 ]; then + echo "unsupported OS X version (os 11+)" + exit 1 + fi + # + # Minor + # + if [ "$OSX_MINOR" -le 5 ]; then + echo "unsupported OS X version (os 10.5-)" + exit 1 + fi - sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" - sudo chown $(whoami) ""$node_install_path"/bin/" + # Snow + if [ "$OSX_MINOR" -eq 6 ]; then + OS='snow' + fi + + # Lion + if [ $OSX_MINOR -eq 7 ]; then + OS='lion' + fi + + # Mountain Lion + if [ "$OSX_MINOR" -eq 8 ]; then + OS='mountain' + fi + + # Mavericks, Yosemite + if [ "$OSX_MINOR" -ge 9 ]; then + OS='mavericks' + fi + + if [ -n "$(sysctl hw | grep 64bit | grep ': 1')" ]; then + ARCH="64" + else + ARCH="32" + fi +elif [ "$(uname | grep -i 'Linux')" ]; then + if [ ! -f "/etc/issue" ]; then + echo "unsupported linux os" + exit 1 + fi + + if [ -n "$(uname -a | grep 64)" ]; then + ARCH="64" + else + ARCH="32" + fi + + if [ "$(cat /etc/issue | grep -i 'Ubuntu')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Linux Mint')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'elementary OS')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Debian')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Trisquel')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Zorin')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Raspbian')" ]; then + OS='raspbian' + elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then + OS='fedora' + elif [ "$(cat /etc/issue | grep -i 'Marvell')" ]; then + OS='marvell' + fi +else + echo "unsupported unknown os (non-mac, non-linux)" + exit 1 fi + +case "${OS}" in + fedora) + echo "FEDORA not yet supported (feel free to pull request)" + exit 1 + ;; + ubuntu) + SETUP_FILE="ubuntu" + ;; + raspbian) + SETUP_FILE="ubuntu" + ;; + marvell) + SETUP_FILE="ubuntu" + ;; + yosemite) + # mavericks + SETUP_FILE="mavericks" + ;; + mavericks) + SETUP_FILE="mavericks" + ;; + mountain) + echo "Mountain Lion not yet supported (feel free to pull request)" + exit 1 + ;; + lion) + echo "Lion not yet supported (feel free to pull request)" + exit 1 + ;; + snow) + echo "Snow Leopard not yet supported (feel free to pull request)" + exit 1 + ;; + *) + echo "unsupported unknown os ${OS}" + exit 1 + ;; +esac + +####################### +# Download installers # +####################### + +if [ -z "$dont_install_deps" ]; 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}" +fi + +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}" \ + -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + elif [ -n "$(type -p wget)" ]; then + 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 [ -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}" \ + -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}" \ + -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi + fi +fi + +if [ ! -e "/tmp/${INSTALL_FILE}" ] +then + echo "Error Downloading Install File" + exit 1 +fi + +if [ -z "$dont_install_deps" ]; then + if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] + then + echo "Error Downloading Deps File" + exit 1 + fi +fi + +######################### +# Which node.js VERSION ? # +######################### + +if [ -f "/tmp/NODEJS_VER" ]; then + NODEJS_VER=$(cat /tmp/NODEJS_VER | grep v) +elif [ -f "/tmp/IOJS_VER" ]; then + NODEJS_VER=$(cat /tmp/IOJS_VER | grep v) +fi + +if [ -n "$NODEJS_VER" ]; then + NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) + + if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] + then + echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" + NODEJS_BASE_URL="https://iojs.org" + NODEJS_NAME="iojs" + fi +fi + +if [ -z "$NODEJS_VER" ]; then + if [ -n "$(type -p curl)" ]; then + NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ + || echo 'error automatically determining current node.js version' + elif [ -n "$(type -p wget)" ]; then + NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1) \ + || echo 'error automatically determining current node.js version' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi +fi + +# +# node +# +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)))" + else + node_install_path=$PREFIX/usr/local + fi +else + node_install_path=$(dirname $(dirname $NODE_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 + echo node ${NODEJS_VER} is already installed + else + echo "" + echo "HEY, LISTEN:" + echo "" + echo "node.js is already installed as node $($node_install_path/bin/node -v | grep v)" + echo "" + echo "to reinstall please first run: rm $node_install_path/bin/node" + echo "" + fi + + NODEJS_VER="" +fi + +if [ -n "${NODEJS_VER}" ]; then + bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" +fi + +sudo chown -R $(whoami) $node_install_path/lib/node_modules + +echo "" + +if [ -z "$dont_install_deps" ]; then + + ################ + # DEPENDENCIES # + ################ + + #if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then + # echo "" + # echo "Your server didn't come with fail2ban preinstalled!!!" + # echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets." + # echo "" + # echo "Since you're obviously connecting this computer to a network, you should install fail2ban before continuing" + # echo "" + # echo "Install fail2ban? [Y/n]" + # echo "(if unsure, just hit [enter])" + # read INSTALL_FAIL2BAN + # + # if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then + # echo "" + # echo "I don't think you understand: This is important." + # echo "" + # echo "Your server will be under constant attack by botnets via ssh." + # echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you." + # echo "" + # echo "Change your mind?" + # echo "Ready to install fail2ban? [Y/n]" + # read INSTALL_FAIL2BAN + # if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then + # clear + # echo "you make me sad :-(" + # sleep 0.5 + # echo "but whatever, it's your funeral..." + # sleep 1 + # NO_FAIL2BAN="nope" + # else + # echo "Phew, dodged the bullet on that one... Will install fail2ban.. :-)" + # fi + # fi + #fi + + bash "/tmp/${INSTALL_DEPS_FILE}" "${NO_FAIL2BAN}" + + # yarn + #if [ -z "$(type -p yarn)" ]; then + # echo "installing yarn..." + # npm install --silent yarn -g > /dev/null + #fi + + # jshint + if [ -z "$(type -p jshint)" ]; then + echo "installing jshint..." + #yarn global add jshint > /dev/null + $node_install_path/bin/npm install -g jshint > /dev/null + fi + + echo "" +fi \ No newline at end of file From fb0a8f6372176413932555ae09b99e27b15386ad Mon Sep 17 00:00:00 2001 From: richdex14 Date: Fri, 1 Sep 2017 20:16:12 -0600 Subject: [PATCH 02/19] Update setup-node-ubuntu.bash to change to Daplie project from coolaj86 private project. --- setup-node-ubuntu.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 6b7afc2..a2ff579 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.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.daplie.com/Daplie/node-install-script # # 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.daplie.com/Daplie/node-install-script/raw/master" #NO_FAIL2BAN="" NO_FAIL2BAN="nope" OS="unsupported" From 0948a728c3e65b06bdfe90775ed4e5da604169fb Mon Sep 17 00:00:00 2001 From: richdex14 Date: Fri, 1 Sep 2017 20:45:22 -0600 Subject: [PATCH 03/19] Update setup-node-ubuntu.bash to use portable `head -n` syntax. --- setup-node-ubuntu.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index a2ff579..5094e3c 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -241,10 +241,10 @@ fi if [ -z "$NODEJS_VER" ]; then if [ -n "$(type -p curl)" ]; then - NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ + NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | head -n 2 | tail -n 1 | cut -f 1) \ || echo 'error automatically determining current node.js version' elif [ -n "$(type -p 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 -n 2 | tail -n 1 | cut -f 1) \ || echo 'error automatically determining current node.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." From a99583fb1d1bbe2c39a2913e139fabfb3eb4e3aa Mon Sep 17 00:00:00 2001 From: richdex14 Date: Fri, 1 Sep 2017 20:54:43 -0600 Subject: [PATCH 04/19] Update setup-min.sh to use Daplie repo instead of coolaj86 private repo. --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index b4dd539..0734a59 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -12,7 +12,7 @@ set -e set -u -BASE_URL="https://git.daplie.com/coolaj86/node-install-script/raw/master" +BASE_URL="https://git.daplie.com/Daplie/node-install-script/raw/master" ####################### # Download installers # From 8a3f4ba77fb183dfd07ce509aa83b464476611a8 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Sat, 2 Sep 2017 11:45:28 -0600 Subject: [PATCH 05/19] Update setup.bash to work on Marvell arm64 OS --- setup.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 0808440..5b85b40 100644 --- a/setup.bash +++ b/setup.bash @@ -95,7 +95,7 @@ elif [ "$(uname | grep -i 'Linux')" ]; then exit 1 fi - if [ -n "$(arch | grep 64)" ]; then + if [ -n "$(uname -a | grep 64)" ]; then ARCH="64" else ARCH="32" @@ -117,6 +117,8 @@ elif [ "$(uname | grep -i 'Linux')" ]; then OS='raspbian' elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then OS='fedora' + elif [ "$(cat /etc/issue | grep -i 'Marvell')" ]; then + OS='marvell' fi else echo "unsupported unknown os (non-mac, non-linux)" @@ -134,6 +136,9 @@ case "${OS}" in raspbian) SETUP_FILE="ubuntu" ;; + marvell) + SETUP_FILE="ubuntu" + ;; yosemite) # mavericks SETUP_FILE="mavericks" From 69bc78680d185e3cbba8801f4cb4f6408208e2e2 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Sat, 2 Sep 2017 11:56:17 -0600 Subject: [PATCH 06/19] Update setup.bash to use Daplie repo instead of coolaj86 repo. --- setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index 5b85b40..bca828d 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.daplie.com/Daplie/node-install-script # # 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.daplie.com/Daplie/node-install-script/raw/master" #NO_FAIL2BAN="" NO_FAIL2BAN="nope" OS="unsupported" From 8a5593363d85492e98acb253c3c896b346ed7a65 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Sat, 2 Sep 2017 12:05:22 -0600 Subject: [PATCH 07/19] Update setup.bash to work with portable `head` command. --- setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index bca828d..d86f9fb 100644 --- a/setup.bash +++ b/setup.bash @@ -241,10 +241,10 @@ fi if [ -z "$NODEJS_VER" ]; then if [ -n "$(type -p curl)" ]; then - NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ + NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | head -n 2 | tail -1 | cut -f 1) \ || echo 'error automatically determining current node.js version' elif [ -n "$(type -p 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 -n 2 | tail -1 | cut -f 1) \ || echo 'error automatically determining current node.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." From 561a2e2fa1f3d1597b6c4d5b8c92346d689ad3ca Mon Sep 17 00:00:00 2001 From: richdex14 Date: Sun, 3 Sep 2017 20:46:44 -0600 Subject: [PATCH 08/19] Correcting copy-paste mistake in `setup-node-ubuntu.bash`. Restoring version from coolaj86 repo. --- setup-node-ubuntu.bash | 379 ++++++----------------------------------- 1 file changed, 49 insertions(+), 330 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 5094e3c..7b80775 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -1,350 +1,69 @@ #!/bin/bash -# Installs node.js only (no development dependencies) for both Ubuntu and OS X - -# -# See https://git.daplie.com/Daplie/node-install-script -# - -# curl -fsSL bit.ly/nodejs-min | bash -# wget -nv bit.ly/nodejs-min -O - | bash - -# curl -fsSL https://example.com/setup-min.bash | bash -# wget -nv https://example.com/setup-min.bash -O - | bash - -dont_install_deps="$1" set -e set -u -#set -o pipefail +set -o pipefail if [ -z "${PREFIX-}" ]; then PREFIX="" fi -NODEJS_NAME="node" -NODEJS_BASE_URL="https://nodejs.org" -BASE_URL="https://git.daplie.com/Daplie/node-install-script/raw/master" -#NO_FAIL2BAN="" -NO_FAIL2BAN="nope" -OS="unsupported" -ARCH="" -NODEJS_VER="" -SETUP_FILE="" - -clear - -######################### -# Which OS and version? # -######################### - -if [ "$(uname | grep -i 'Darwin')" ]; then - OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)" - OSX_MAJOR="$(echo ${OSX_VER} | cut -d'.' -f1)" - OSX_MINOR="$(echo ${OSX_VER} | cut -d'.' -f2)" - OSX_PATCH="$(echo ${OSX_VER} | cut -d'.' -f3)" - - # - # Major - # - if [ "$OSX_MAJOR" -lt 10 ]; then - echo "unsupported OS X version (os 9-)" - exit 1 - fi - - if [ "$OSX_MAJOR" -gt 10 ]; then - echo "unsupported OS X version (os 11+)" - exit 1 - fi - - # - # Minor - # - if [ "$OSX_MINOR" -le 5 ]; then - echo "unsupported OS X version (os 10.5-)" - exit 1 - fi - - # Snow - if [ "$OSX_MINOR" -eq 6 ]; then - OS='snow' - fi - - # Lion - if [ $OSX_MINOR -eq 7 ]; then - OS='lion' - fi - - # Mountain Lion - if [ "$OSX_MINOR" -eq 8 ]; then - OS='mountain' - fi - - # Mavericks, Yosemite - if [ "$OSX_MINOR" -ge 9 ]; then - OS='mavericks' - fi - - if [ -n "$(sysctl hw | grep 64bit | grep ': 1')" ]; then - ARCH="64" - else - ARCH="32" - fi -elif [ "$(uname | grep -i 'Linux')" ]; then - if [ ! -f "/etc/issue" ]; then - echo "unsupported linux os" - exit 1 - fi - - if [ -n "$(uname -a | grep 64)" ]; then - ARCH="64" - else - ARCH="32" - fi - - if [ "$(cat /etc/issue | grep -i 'Ubuntu')" ]; then - OS='ubuntu' - elif [ "$(cat /etc/issue | grep -i 'Linux Mint')" ]; then - OS='ubuntu' - elif [ "$(cat /etc/issue | grep -i 'elementary OS')" ]; then - OS='ubuntu' - elif [ "$(cat /etc/issue | grep -i 'Debian')" ]; then - OS='ubuntu' - elif [ "$(cat /etc/issue | grep -i 'Trisquel')" ]; then - OS='ubuntu' - elif [ "$(cat /etc/issue | grep -i 'Zorin')" ]; then - OS='ubuntu' - elif [ "$(cat /etc/issue | grep -i 'Raspbian')" ]; then - OS='raspbian' - elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then - OS='fedora' - elif [ "$(cat /etc/issue | grep -i 'Marvell')" ]; then - OS='marvell' - fi -else - echo "unsupported unknown os (non-mac, non-linux)" - exit 1 -fi - -case "${OS}" in - fedora) - echo "FEDORA not yet supported (feel free to pull request)" - exit 1 - ;; - ubuntu) - SETUP_FILE="ubuntu" - ;; - raspbian) - SETUP_FILE="ubuntu" - ;; - marvell) - SETUP_FILE="ubuntu" - ;; - yosemite) - # mavericks - SETUP_FILE="mavericks" - ;; - mavericks) - SETUP_FILE="mavericks" - ;; - mountain) - echo "Mountain Lion not yet supported (feel free to pull request)" - exit 1 - ;; - lion) - echo "Lion not yet supported (feel free to pull request)" - exit 1 - ;; - snow) - echo "Snow Leopard not yet supported (feel free to pull request)" - exit 1 - ;; - *) - echo "unsupported unknown os ${OS}" - exit 1 - ;; -esac - -####################### -# Download installers # -####################### - -if [ -z "$dont_install_deps" ]; 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}" -fi - -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}" \ - -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' - elif [ -n "$(type -p wget)" ]; then - 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 [ -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}" \ - -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}" \ - -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" - else - echo "Found neither 'curl' nor 'wget'. Can't Continue." - exit 1 - fi - fi -fi - -if [ ! -e "/tmp/${INSTALL_FILE}" ] -then - echo "Error Downloading Install File" - exit 1 -fi - -if [ -z "$dont_install_deps" ]; then - if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] - then - echo "Error Downloading Deps File" - exit 1 - fi -fi - -######################### -# Which node.js VERSION ? # -######################### - -if [ -f "/tmp/NODEJS_VER" ]; then - NODEJS_VER=$(cat /tmp/NODEJS_VER | grep v) -elif [ -f "/tmp/IOJS_VER" ]; then - NODEJS_VER=$(cat /tmp/IOJS_VER | grep v) -fi - -if [ -n "$NODEJS_VER" ]; then - NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) - - if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] - then - echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" - NODEJS_BASE_URL="https://iojs.org" - NODEJS_NAME="iojs" - fi -fi - -if [ -z "$NODEJS_VER" ]; then - if [ -n "$(type -p curl)" ]; then - NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | head -n 2 | tail -n 1 | cut -f 1) \ - || echo 'error automatically determining current node.js version' - elif [ -n "$(type -p wget)" ]; then - NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -n 2 | tail -n 1 | cut -f 1) \ - || echo 'error automatically determining current node.js version' - else - echo "Found neither 'curl' nor 'wget'. Can't Continue." - exit 1 - fi -fi - -# -# node -# 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)))" - else - node_install_path=$PREFIX/usr/local - fi + node_install_path=$PREFIX/usr/local else node_install_path=$(dirname $(dirname $NODE_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 - echo node ${NODEJS_VER} is already installed - else - echo "" - echo "HEY, LISTEN:" - echo "" - echo "node.js is already installed as node $($node_install_path/bin/node -v | grep v)" - echo "" - echo "to reinstall please first run: rm $node_install_path/bin/node" - echo "" - fi - NODEJS_VER="" +NODEJS_VER=${1} +NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) + +NODEJS_NAME="node" +NODEJS_BASE_URL="https://nodejs.org" + +if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] +then + echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" + NODEJS_BASE_URL="https://iojs.org" + NODEJS_NAME="iojs" fi +if [ -n "$(arch | grep aarch64)" ]; then + ARCH="arm64" +elif [ -n "$(arch | grep 64)" ]; then + ARCH="x64" +elif [ -n "$(arch | grep armv8l)" ]; then + ARCH="arm64" +elif [ -n "$(arch | grep armv7l)" ]; then + ARCH="armv7l" +elif [ -n "$(arch | grep armv6l)" ]; then + ARCH="armv6l" +else + ARCH="x86" +fi + +NODEJS_REMOTE="${NODEJS_BASE_URL}/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz" +NODEJS_LOCAL="/tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz" +NODEJS_UNTAR="/tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}" + if [ -n "${NODEJS_VER}" ]; then - bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" -fi + echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..." -sudo chown -R $(whoami) $node_install_path/lib/node_modules - -echo "" - -if [ -z "$dont_install_deps" ]; then - - ################ - # DEPENDENCIES # - ################ - - #if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then - # echo "" - # echo "Your server didn't come with fail2ban preinstalled!!!" - # echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets." - # echo "" - # echo "Since you're obviously connecting this computer to a network, you should install fail2ban before continuing" - # echo "" - # echo "Install fail2ban? [Y/n]" - # echo "(if unsure, just hit [enter])" - # read INSTALL_FAIL2BAN - # - # if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then - # echo "" - # echo "I don't think you understand: This is important." - # echo "" - # echo "Your server will be under constant attack by botnets via ssh." - # echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you." - # echo "" - # echo "Change your mind?" - # echo "Ready to install fail2ban? [Y/n]" - # read INSTALL_FAIL2BAN - # if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then - # clear - # echo "you make me sad :-(" - # sleep 0.5 - # echo "but whatever, it's your funeral..." - # sleep 1 - # NO_FAIL2BAN="nope" - # else - # echo "Phew, dodged the bullet on that one... Will install fail2ban.. :-)" - # fi - # fi - #fi - - bash "/tmp/${INSTALL_DEPS_FILE}" "${NO_FAIL2BAN}" - - # yarn - #if [ -z "$(type -p yarn)" ]; then - # echo "installing yarn..." - # npm install --silent yarn -g > /dev/null - #fi - - # jshint - if [ -z "$(type -p jshint)" ]; then - echo "installing jshint..." - #yarn global add jshint > /dev/null - $node_install_path/bin/npm install -g jshint > /dev/null + if [ -n "$(which curl 2>/dev/null)" ]; then + curl -fsSL ${NODEJS_REMOTE} -o ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' + elif [ -n "$(which wget 2>/dev/null)" ]; then + wget --quiet ${NODEJS_REMOTE} -O ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' + else + echo "'wget' and 'curl' are missing. Please run the following command and try again" + echo "\tsudo apt-get install --yes curl wget" + exit 1 fi - echo "" -fi \ No newline at end of file + mkdir -p ${NODEJS_UNTAR}/ + tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ --strip-components=1 + rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} + sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + + + sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" + sudo chown $(whoami) ""$node_install_path"/bin/" +fi From 31b92cdadb1b234383bf3dc270c7e39468f59e0f Mon Sep 17 00:00:00 2001 From: richdex14 Date: Sun, 3 Sep 2017 20:47:40 -0600 Subject: [PATCH 09/19] Update setup-node-ubuntu.bash to replace `arch` call with portable call to `uname -a` --- setup-node-ubuntu.bash | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 7b80775..9c44226 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -27,15 +27,15 @@ then NODEJS_NAME="iojs" fi -if [ -n "$(arch | grep aarch64)" ]; then +if [ -n "$(uname -a | grep aarch64)" ]; then ARCH="arm64" -elif [ -n "$(arch | grep 64)" ]; then +elif [ -n "$(uname -a | grep 64)" ]; then ARCH="x64" -elif [ -n "$(arch | grep armv8l)" ]; then +elif [ -n "$(uname -a | grep armv8l)" ]; then ARCH="arm64" -elif [ -n "$(arch | grep armv7l)" ]; then +elif [ -n "$(uname -a | grep armv7l)" ]; then ARCH="armv7l" -elif [ -n "$(arch | grep armv6l)" ]; then +elif [ -n "$(uname -a | grep armv6l)" ]; then ARCH="armv6l" else ARCH="x86" From 6c0afe64889b624f422bd88476cc3ebe9d0b816d Mon Sep 17 00:00:00 2001 From: richdex14 Date: Sun, 3 Sep 2017 21:13:47 -0600 Subject: [PATCH 10/19] Update setup-node-ubuntu.bash to use portable copy method as opposed to non-portable `tar --strip-components` in unpacking step. --- setup-node-ubuntu.bash | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 9c44226..ce63778 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -59,11 +59,14 @@ if [ -n "${NODEJS_VER}" ]; then fi mkdir -p ${NODEJS_UNTAR}/ - tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ --strip-components=1 - rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} + # --strip-components isn't portable, switch to portable version by performing move step after untar + tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ #--strip-components=1 + mv ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}/* ${NODEJS_UNTAR}/ + rm -rf ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH} # clean up the temporary unzip folder + rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" sudo chown $(whoami) ""$node_install_path"/bin/" -fi +fi \ No newline at end of file From 16a6d7e18c9d302316512b88a71bf776287c83fd Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 11:11:18 -0600 Subject: [PATCH 11/19] Debugging installer script issues on daplie board. --- setup-node-ubuntu.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index ce63778..33d47d3 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -64,6 +64,8 @@ if [ -n "${NODEJS_VER}" ]; then mv ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}/* ${NODEJS_UNTAR}/ rm -rf ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH} # clean up the temporary unzip folder rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} + echo "$node_install_path" + echo "${NODEJS_UNTAR}" sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" From ae331149f7db6e96f437323f667aa51565cc014d Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 11:28:57 -0600 Subject: [PATCH 12/19] Debugging file copy issues on daplie board. --- setup-node-ubuntu.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 33d47d3..f97e3ff 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -66,7 +66,8 @@ if [ -n "${NODEJS_VER}" ]; then rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} echo "$node_install_path" echo "${NODEJS_UNTAR}" - sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + sudo cp -rf "${NODEJS_UNTAR}/" "$node_install_path/" + sync sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" From 28c1ad84846e3a4039bb23db1b01dc552cfe220d Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 11:35:52 -0600 Subject: [PATCH 13/19] Debugging copying issues --- setup-node-ubuntu.bash | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index f97e3ff..87428ca 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -66,9 +66,8 @@ if [ -n "${NODEJS_VER}" ]; then rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} echo "$node_install_path" echo "${NODEJS_UNTAR}" - sudo cp -rf "${NODEJS_UNTAR}/" "$node_install_path/" - sync - + sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + echo "Done copying" sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" sudo chown $(whoami) ""$node_install_path"/bin/" From 351056f9bc9c6f003e42e6a3d915d6f18d383681 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 11:39:30 -0600 Subject: [PATCH 14/19] Update setup-node-ubuntu.bash --- setup-node-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 87428ca..753ce20 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -66,7 +66,7 @@ if [ -n "${NODEJS_VER}" ]; then rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} echo "$node_install_path" echo "${NODEJS_UNTAR}" - sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + sudo rsync -av "${NODEJS_UNTAR}/" "$node_install_path/" echo "Done copying" sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" From a24f92df987d13b61a1bac518fe86dac5a1493c0 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 12:18:57 -0600 Subject: [PATCH 15/19] Update setup.bash to use portable `$sudo_cmd` syntax --- setup.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index d86f9fb..b6ce0d6 100644 --- a/setup.bash +++ b/setup.bash @@ -12,6 +12,10 @@ # curl -fsSL https://example.com/setup-min.bash | bash # wget -nv https://example.com/setup-min.bash -O - | bash +# Not every platform has or needs sudo, gotta save them O(1)s... +sudo_cmd="" +((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo" + dont_install_deps="$1" set -e set -u @@ -287,7 +291,7 @@ if [ -n "${NODEJS_VER}" ]; then bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" fi -sudo chown -R $(whoami) $node_install_path/lib/node_modules +$sudo_cmd chown -R $(whoami) $node_install_path/lib/node_modules echo "" From 2f9f3c0c826cf1a5f7fc5333f30f1a74efa316bd Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 12:20:00 -0600 Subject: [PATCH 16/19] Update setup-node-ubuntu.bash to use portable `$sudo_cmd` syntax --- setup-node-ubuntu.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index 753ce20..db3210d 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -1,5 +1,9 @@ #!/bin/bash +# Not every platform has or needs sudo, gotta save them O(1)s... +sudo_cmd="" +((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo" + set -e set -u set -o pipefail @@ -66,9 +70,9 @@ if [ -n "${NODEJS_VER}" ]; then rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} echo "$node_install_path" echo "${NODEJS_UNTAR}" - sudo rsync -av "${NODEJS_UNTAR}/" "$node_install_path/" + $sudo_cmd rsync -av "${NODEJS_UNTAR}/" "$node_install_path/" echo "Done copying" - sudo chown -R $(whoami) "$node_install_path/lib/node_modules/" - sudo chown $(whoami) ""$node_install_path"/bin/" + $sudo_cmd chown -R $(whoami) "$node_install_path/lib/node_modules/" + $sudo_cmd chown $(whoami) ""$node_install_path"/bin/" fi \ No newline at end of file From 6252737cc1915a2a100aafaef06448d1aaabb3a0 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 13:35:16 -0600 Subject: [PATCH 17/19] Update setup-deps-ubuntu.bash to use portable `sudo_cmd` syntax --- setup-deps-ubuntu.bash | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup-deps-ubuntu.bash b/setup-deps-ubuntu.bash index 1185389..16ef7c2 100644 --- a/setup-deps-ubuntu.bash +++ b/setup-deps-ubuntu.bash @@ -2,6 +2,10 @@ # curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c +# Not every platform has or needs sudo, gotta save them O(1)s... +sudo_cmd="" +((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo" + NO_FAIL2BAN=${1} echo "" @@ -18,7 +22,7 @@ echo " * jshint" echo "" echo "updating apt-get..." -sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null +$sudo_cmd bash -c "apt-get update -qq -y < /dev/null" > /dev/null # fail2ban #if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then @@ -32,5 +36,5 @@ sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null if [ -z "$(type -p pkg-config)" ] || [ -z "$(type -p git)" ] || [ -z "$(type -p wget)" ] || [ -z "$(type -p curl)" ] || [ -z "$(type -p gcc)" ] || [ -z "$(type -p rsync)" ] || [ -z "$(type -p python)" ] then echo "installing git, wget, curl, build-essential, rsync, pkg-config, python..." - sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config python < /dev/null" > /dev/null 2>/dev/null + $sudo_cmd bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config python < /dev/null" > /dev/null 2>/dev/null fi From aed892007fa749e0255e53a3a90a09d9b847d6e6 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 14:35:23 -0600 Subject: [PATCH 18/19] Clean up debugging from copying paths issue. --- setup-node-ubuntu.bash | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index db3210d..1eaa5b7 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -68,10 +68,8 @@ if [ -n "${NODEJS_VER}" ]; then mv ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}/* ${NODEJS_UNTAR}/ rm -rf ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH} # clean up the temporary unzip folder rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} - echo "$node_install_path" - echo "${NODEJS_UNTAR}" $sudo_cmd rsync -av "${NODEJS_UNTAR}/" "$node_install_path/" - echo "Done copying" + rm -rf "${NODEJS_UNTAR}" $sudo_cmd chown -R $(whoami) "$node_install_path/lib/node_modules/" $sudo_cmd chown $(whoami) ""$node_install_path"/bin/" From e57069fe5084920d2b3364392349f800a92f474e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 6 Nov 2017 13:17:09 -0700 Subject: [PATCH 19/19] 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