From 8ce19953decc874e1d14bbad639e44d0f954c346 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Tue, 8 Nov 2022 22:08:51 -0800 Subject: [PATCH] Update node install scripts --- node/.local/bin/install-node-home | 4 ++-- node/.local/bin/install-node-system | 7 ++++--- node/.local/share/buddy-up/includes/node.sh | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/node/.local/bin/install-node-home b/node/.local/bin/install-node-home index dadc126..d392c73 100755 --- a/node/.local/bin/install-node-home +++ b/node/.local/bin/install-node-home @@ -5,7 +5,7 @@ set -euo pipefail # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/node.sh" -VERSION=${VERSION:-node_lts} +VERSION=${VERSION:-$(node_lts)} DEST=${XDG_DATA_HOME}/apps/releases/node CURRENT=${DEST}/current @@ -15,7 +15,7 @@ URL=https://nodejs.org/dist/${VERSION}/node-${VERSION}-$(get_os)-$(get_arch).tar extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" set_current_link "${DEST}" "${VERSION}" -APPS=$(find "${CURRENT}"/bin -not -type d -exec basename {} ';') +APPS=$(find "${DEST}/${VERSION}/bin" -not -type d -exec basename {} ';') for app in ${APPS}; do set_symlink "${CURRENT}/bin/${app}" "${XDG_BIN_HOME}/${app}" done diff --git a/node/.local/bin/install-node-system b/node/.local/bin/install-node-system index c00f554..0db8705 100755 --- a/node/.local/bin/install-node-system +++ b/node/.local/bin/install-node-system @@ -5,9 +5,10 @@ set -e # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/node.sh" +VERSION=${VERSION:-$(node_lts)} PREFIX=${PREFIX:-/usr/local} -DEST="${PREFIX}/apps/releases/node" -CURRENT="${DEST}/current" +DEST=${PREFIX}/apps/releases/node +CURRENT=${DEST}/current # shellcheck disable=SC2034 URL=https://nodejs.org/dist/${VERSION}/node-${VERSION}-$(get_os)-$(get_arch).tar.xz @@ -15,7 +16,7 @@ URL=https://nodejs.org/dist/${VERSION}/node-${VERSION}-$(get_os)-$(get_arch).tar extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" sudo set_current_link "${DEST}" "${VERSION}" sudo -APPS=$(find "${CURRENT}"/bin -not -type d -exec basename {} ';') +APPS=$(find "${DEST}/${VERSION}/bin" -not -type d -exec basename {} ';') for app in ${APPS}; do set_symlink "${CURRENT}/bin/${app}" "${PREFIX}/bin/${app}" sudo done diff --git a/node/.local/share/buddy-up/includes/node.sh b/node/.local/share/buddy-up/includes/node.sh index f521e6a..dbec8be 100644 --- a/node/.local/share/buddy-up/includes/node.sh +++ b/node/.local/share/buddy-up/includes/node.sh @@ -4,6 +4,12 @@ source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" node_lts () ( + curl --silent https://nodejs.org/dist/index.tab | + cut -f 1,10 | grep -v '-' | head -n 2 | tail -n 1 | cut -f 1 +) + + +node_current () ( curl --silent https://nodejs.org/dist/index.tab | cut -f 1,10 | grep '-' | head -n 1 | cut -f 1 )