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.
42 lines
1.0 KiB
Bash
42 lines
1.0 KiB
Bash
4 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# shellcheck disable=SC1090
|
||
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
||
|
|
||
3 years ago
|
node_lts () (
|
||
2 years ago
|
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 () (
|
||
3 years ago
|
curl --silent https://nodejs.org/dist/index.tab |
|
||
|
cut -f 1,10 | grep '-' | head -n 1 | cut -f 1
|
||
|
)
|
||
|
|
||
|
get_arch () (
|
||
4 years ago
|
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
|
||
3 years ago
|
)
|
||
4 years ago
|
|
||
3 years ago
|
set_symlink () (
|
||
|
src=${1}
|
||
|
dest=${2}
|
||
|
sudo=${3:-}
|
||
4 years ago
|
dest_dir=$(dirname "${dest}")
|
||
|
|
||
4 years ago
|
mkdir_if_missing "${dest_dir}" "$sudo"
|
||
4 years ago
|
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
|
||
3 years ago
|
)
|