Update node install scripts

main
Buddy Sandidge 2 years ago
parent 18246be28e
commit 8ce19953de

@ -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

@ -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

@ -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
)

Loading…
Cancel
Save