From 01c95cd139e20c051d4cd73fd4c35f0d8aba5bfe Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Tue, 6 Jul 2021 01:41:59 -0700 Subject: [PATCH] Fix node system install script --- node/.local/bin/install-node-system | 17 ++++++++++------- node/.local/share/buddy-up/includes/node.sh | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/node/.local/bin/install-node-system b/node/.local/bin/install-node-system index 7a2e58f..8ddf964 100755 --- a/node/.local/bin/install-node-system +++ b/node/.local/bin/install-node-system @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/node.sh" @@ -7,14 +9,15 @@ PREFIX=${PREFIX:-/usr/local} DEST="${PREFIX}/apps/releases/node" CURRENT="${DEST}/current" -extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" "sudo" -set_current_link "${DEST}" "${VERSION}" "sudo" +extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" sudo +set_current_link "${DEST}" "${VERSION}" sudo -for app in "${CURRENT}"/bin/*; do - set_symlink "${CURRENT}/bin/${app}" "${XDG_BIN_HOME}/${app}" sudo +APPS=$(find "${CURRENT}"/bin -not -type d -exec basename {} ';') +for app in ${APPS}; do + set_symlink "${CURRENT}/bin/${app}" "${PREFIX}/bin/${app}" sudo done set_symlink "${CURRENT}/include/node" "${PREFIX}/include/node" sudo -set_symlink "${CURRENT}/share/doc/node" "${CURRENT}/share/doc/node" sudo -set_symlink "${CURRENT}/share/man/man1/node.1" "${CURRENT}/share/man/man1/node.1" sudo -set_symlink "${CURRENT}/share/systemtap/tapset/node.stp" "${CURRENT}/share/systemtap/tapset/node.stp" sudo +set_symlink "${CURRENT}/share/doc/node" "${PREFIX}/share/doc/node" sudo +set_symlink "${CURRENT}/share/man/man1/node.1" "${PREFIX}/share/man/man1/node.1" sudo +set_symlink "${CURRENT}/share/systemtap/tapset/node.stp" "${PREFIX}/share/systemtap/tapset/node.stp" sudo diff --git a/node/.local/share/buddy-up/includes/node.sh b/node/.local/share/buddy-up/includes/node.sh index fb3a384..c216ad5 100644 --- a/node/.local/share/buddy-up/includes/node.sh +++ b/node/.local/share/buddy-up/includes/node.sh @@ -22,7 +22,7 @@ set_symlink () { sudo="$3" dest_dir=$(dirname "${dest}") - mkdir_if_missing "${dest_dir}" + mkdir_if_missing "${dest_dir}" "$sudo" pushd "${dest_dir}" > /dev/null || exit 1 unlink_if_set "${dest}" "${sudo}" $sudo ln -s "$(relative_path "${dest_dir}" "${src}")" "$(basename "${dest}")"