Files
leleka/scripts/e2e/codex/compare/install-node.sh
T

19 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# Install the Node.js toolchain of the Codex comparison on rnr5090 (runs ON the server, as a CPU-only queue job so it cannot disturb a measuring job):
# the newest v22 LTS linux-x64 tarball from nodejs.org, checked against SHASUMS256.txt, unpacked into codex-compare/toolchain/ and made read-only.
set -euo pipefail
T=/data/leleka-e2e/codex-compare/toolchain
NOTES=/data/leleka-e2e/decode/notes.md
note() { echo "[$(date -u +%FT%TZ)] [DEV codex-compare] $*" >>"$NOTES"; }
mkdir -p "$T/dl"; cd "$T/dl"
V=$(curl -fsS https://nodejs.org/dist/index.json | python3 -c "import json,sys; d=json.load(sys.stdin); print([x['version'] for x in d if x['version'].startswith('v22.') and x['lts']][0])")
F=node-$V-linux-x64.tar.xz
[ -f "$F" ] || curl -fsS -o "$F" "https://nodejs.org/dist/$V/$F"
curl -fsS -o SHASUMS256.txt "https://nodejs.org/dist/$V/SHASUMS256.txt"
grep " $F\$" SHASUMS256.txt | sha256sum -c -
if [ ! -x "$T/node-$V-linux-x64/bin/node" ]; then nice -n 19 ionice -c3 tar -xJf "$F" -C "$T"; chmod -R a-w "$T/node-$V-linux-x64"; fi
export PATH="$T/node-$V-linux-x64/bin:$PATH" # npm's shebang is `env node`
node --version
npm --version
note "codex-compare toolchain: node $V installed in $T ($(grep " $F\$" SHASUMS256.txt | cut -c1-16)...)"