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