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.
36 lines
920 B
Bash
36 lines
920 B
Bash
#!/usr/bin/env bash
|
|
|
|
# shellcheck disable=SC1090
|
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
|
|
|
node_lts () (
|
|
curl --silent https://nodejs.org/dist/index.tab |
|
|
cut -f 1,10 | grep '-' | head -n 1 | cut -f 1
|
|
)
|
|
|
|
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}" "$sudo"
|
|
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
|
|
)
|