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.

35 lines
931 B
Bash

#!/usr/bin/env bash
# shellcheck disable=SC1090
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () {
case $(uname -m) in
x86_64*) echo x64;;
amd64*) echo x64;;
arm) echo armv7l;;
armv7*) echo armv7l;;
armv6*) echo armv7l;;
armv8*) echo arm64;;
aarch64*) echo arm64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
set_symlink () {
src="$1"
dest="$2"
sudo="$3"
dest_dir=$(dirname "${dest}")
mkdir_if_missing "${dest_dir}"
pushd "${dest_dir}" > /dev/null || exit 1
unlink_if_set "${dest}" "${sudo}"
$sudo ln -s "$(relative_path "${dest_dir}" "${src}")" "$(basename "${dest}")"
popd > /dev/null || exit 1
}
VERSION=${VERSION:-v14.17.3}
# shellcheck disable=SC2034
URL=https://nodejs.org/dist/${VERSION}/node-${VERSION}-$(get_os)-$(get_arch).tar.xz