From 0d6e15ee62ec033c3085147c3ccac7caee21cdb4 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 26 Jul 2018 20:48:00 +0000 Subject: [PATCH] don't rely on rsync --- setup-node-ubuntu.bash | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/setup-node-ubuntu.bash b/setup-node-ubuntu.bash index baf951b..1bebddd 100644 --- a/setup-node-ubuntu.bash +++ b/setup-node-ubuntu.bash @@ -55,9 +55,9 @@ NODEJS_UNTAR="$my_tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}" if [ -n "${NODEJS_VER}" ]; then echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..." - if [ -n "$(which curl 2>/dev/null)" ]; then + if [ -n "$(command -v curl 2>/dev/null | grep curl)" ]; then curl -fsSL ${NODEJS_REMOTE} -o ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' - elif [ -n "$(which wget 2>/dev/null)" ]; then + elif [ -n "$(command -v wget 2>/dev/null | grep wget)" ]; 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" @@ -71,8 +71,13 @@ 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 $sudo_cmd rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" - rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" || $sudo_cmd rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then + echo $sudo_cmd rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" || $sudo_cmd rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" + else + echo $sudo_cmd cp -a "${NODEJS_UNTAR}/" "$node_install_path/" + cp -a "${NODEJS_UNTAR}/" "$node_install_path/" || $sudo_cmd cp -a "${NODEJS_UNTAR}/" "$node_install_path/" + fi rm -rf "${NODEJS_UNTAR}" chown -R $(whoami) "$node_install_path/lib/node_modules/" || $sudo_cmd chown -R $(whoami) "$node_install_path/lib/node_modules/"