From 586863fb756c76ae769cfb6d0cc1da78cca6d0ce Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 29 May 2017 18:03:29 -0600 Subject: [PATCH] check install deps file separately --- setup.bash | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/setup.bash b/setup.bash index be4b6ee..a6c7c26 100644 --- a/setup.bash +++ b/setup.bash @@ -171,20 +171,11 @@ fi INSTALL_DEPS_FILE="setup-deps-${SETUP_FILE}.bash" INSTALL_FILE="setup-node-${SETUP_FILE}.bash" -if [ ! -e "/tmp/${INSTALL_FILE}" ] -then +if [ ! -e "/tmp/${INSTALL_FILE}" ]; then if [ -n "$(type -p curl)" ]; then - if [ -z "$dont_install_deps" ]; then - curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \ - -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" - fi curl --silent "${BASE_URL}/${INSTALL_FILE}" \ -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' elif [ -n "$(type -p wget)" ]; then - if [ -z "$dont_install_deps" ]; then - wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \ - -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" - fi wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' else @@ -193,6 +184,21 @@ then 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" @@ -229,10 +235,10 @@ if [ -n "$NODEJS_VER" ]; then fi if [ -z "$NODEJS_VER" ]; then - if [ -n "$(which curl)" ]; 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 "$(which wget)" ]; then + 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 @@ -265,7 +271,7 @@ if [ -e "$node_install_path/bin/node" ]; then echo "" echo "node.js is already installed as node $(node -v | grep v)" echo "" - echo "to reinstall please first run: rm $(which node)" + echo "to reinstall please first run: rm $(type -p node)" echo "" fi