mirror of https://github.com/zulip/zulip.git
40 lines
1.0 KiB
Bash
Executable File
40 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
version=14.17.6
|
|
arch="$(uname -m)"
|
|
|
|
case $arch in
|
|
x86_64)
|
|
tarball="node-v$version-linux-x64.tar.xz"
|
|
sha256=3bbe4faf356738d88b45be222bf5e858330541ff16bd0d4cfad36540c331461b
|
|
;;
|
|
|
|
aarch64)
|
|
tarball="node-v$version-linux-arm64.tar.xz"
|
|
sha256=9c4f3a651e03cd9b5bddd33a80e8be6a6eb15e518513e410bb0852a658699156
|
|
;;
|
|
esac
|
|
|
|
check_version() {
|
|
out="$(node --version)" && [ "$out" = "v$version" ]
|
|
}
|
|
|
|
if ! check_version; then
|
|
tmpdir="$(mktemp -d)"
|
|
trap 'rm -r "$tmpdir"' EXIT
|
|
cd "$tmpdir"
|
|
curl_opts=(-fLO)
|
|
if [ -n "${CUSTOM_CA_CERTIFICATES:-}" ]; then
|
|
curl_opts+=(--cacert "${CUSTOM_CA_CERTIFICATES}")
|
|
fi
|
|
curl "${curl_opts[@]}" "https://nodejs.org/dist/v$version/$tarball"
|
|
sha256sum -c <<<"$sha256 $tarball"
|
|
rm -rf /srv/zulip-node
|
|
mkdir -p /srv/zulip-node
|
|
tar -xJf "$tarball" --no-same-owner --strip-components=1 -C /srv/zulip-node
|
|
ln -sf /srv/zulip-node/bin/{node,npm,npx} /usr/local/bin
|
|
rm -rf /usr/local/nvm
|
|
check_version
|
|
fi
|