You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
957 B
Bash

#!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1090
source "${XDG_DATA_HOME}/buddy-up/includes/node.sh"
VERSION=${VERSION:-$(node_lts)}
DEST=${XDG_DATA_HOME}/apps/releases/node
CURRENT=${DEST}/current
# shellcheck disable=SC2034
URL=https://nodejs.org/dist/${VERSION}/node-${VERSION}-$(get_os)-$(get_arch).tar.xz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"
set_current_link "${DEST}" "${VERSION}"
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
set_symlink "${CURRENT}/include/node" "${XDG_INCLUDE_HOME}/node"
set_symlink "${CURRENT}/share/doc/node" "${XDG_DATA_HOME}/doc/node"
set_symlink "${CURRENT}/share/man/man1/node.1" "${MAN_DIR}/node.1"
set_symlink "${CURRENT}/share/systemtap/tapset/node.stp" "${XDG_DATA_HOME}/systemtap/tapset/node.stp"