|
|
|
@ -18,21 +18,31 @@ get_arch () {
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APPS="node npm npx"
|
|
|
|
|
VERSION=${VERSION:-v14.17.3}
|
|
|
|
|
DEST="${XDG_DATA_HOME}/apps/releases/node"
|
|
|
|
|
CURRENT="${DEST}/current"
|
|
|
|
|
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}"
|
|
|
|
|
|
|
|
|
|
pushd "${XDG_BIN_HOME}" >/dev/null
|
|
|
|
|
for app in ${APPS}; do
|
|
|
|
|
if [[ -L "${XDG_BIN_HOME}/${app}" ]]; then
|
|
|
|
|
unlink "${XDG_BIN_HOME}/${app}"
|
|
|
|
|
fi
|
|
|
|
|
set_symlink () {
|
|
|
|
|
local src="$1"
|
|
|
|
|
local dest="$2"
|
|
|
|
|
dest_dir=$(dirname "${dest}")
|
|
|
|
|
|
|
|
|
|
REL_LINK="$(relative_path "${XDG_BIN_HOME}" "${DEST}/current/bin/${app}")"
|
|
|
|
|
ln --symbolic "${REL_LINK}" "${app}"
|
|
|
|
|
mkdir_if_missing "${dest_dir}"
|
|
|
|
|
pushd "${dest_dir}" > /dev/null || exit 1
|
|
|
|
|
unlink_if_set "${dest}"
|
|
|
|
|
ln -s "$(relative_path "${dest_dir}" "${src}")" "$(basename "${dest}")"
|
|
|
|
|
popd > /dev/null || exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for app in "${CURRENT}"/bin/*; do
|
|
|
|
|
set_symlink "${CURRENT}/bin/${app}" "${XDG_BIN_HOME}/${app}"
|
|
|
|
|
done
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|