blob: 4cb413fd74842741e0aaada70d5916387afc49b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/bash
set -x -e -v
# This script is for repacking Node (and NPM) from nodejs.org.
WORKSPACE=$HOME/workspace
case "$1" in
linux64) ARCH=linux-x64 ;;
macosx64) ARCH=darwin-x64 ;;
win64) ARCH=win-x64 ;;
win32) ARCH=win-x86 ;;
*)
echo "Unknown architecture $1 not recognized in repack-node.sh" >&2
exit 1
;;
esac
case "$ARCH" in
linux-x64|darwin-x64)
SUFFIX=tar.xz
UNARCHIVE="tar xaf"
REPACK_TAR_COMPRESSION_SWITCH=J
REPACK_SUFFIX=tar.xz
;;
win-x64|win-x86)
SUFFIX=zip
UNARCHIVE=unzip
REPACK_TAR_COMPRESSION_SWITCH=j
REPACK_SUFFIX=tar.bz2
;;
esac
# Although we're only using one version at the moment, this infrastructure is
# useful for when we need to do upgrades and have multiple versions of node
# live in taskcluster at once.
case "$2" in
10) VERSION="10.23.1" ;;
*)
echo "Unknown version $2 not recognized in repack-node.sh" >&2
exit 1
;;
esac
case "$ARCH--$VERSION" in
# From https://nodejs.org/dist/v10.23.1/SHASUMS256.txt.asc
linux-x64--10.23.1) SHA256SUM=207e5ec77ca655ba6fcde922d6b329acbb09898b0bd793ccfcce6c27a36fdff0 ;;
darwin-x64--10.23.1) SHA256SUM=febfdabd98ab5b8f8fdff32ab8c111d834083805bf042ab65c923cc22609c99d ;;
win-x64--10.23.1) SHA256SUM=497996aa1037b6f7f492c1d275bb90140269223939525286b4e95babad16f0de ;;
win-x86--10.23.1) SHA256SUM=c3be0fd50c218cc52e85377c9e22d7d2110d72de95bdbc9447145b246330f818 ;;
esac
# From https://nodejs.org/en/download/
URL=https://nodejs.org/dist/v$VERSION/node-v$VERSION-$ARCH.$SUFFIX
ARCHIVE=node-v$VERSION-$ARCH.$SUFFIX
mkdir -p "$UPLOAD_DIR"
cd "$WORKSPACE"
wget --progress=dot:mega $URL
# shasum is available on both Linux and Windows builders, but on
# Windows, reading from stdin doesn't work as expected.
echo "$SHA256SUM $ARCHIVE" > node.txt
shasum --algorithm 256 --check node.txt
$UNARCHIVE $ARCHIVE
mv node-v$VERSION-$ARCH node
# npx doesn't have great security characteristics (it downloads and executes
# stuff directly out of npm at runtime), so let's not risk it getting into
# anyone's PATH who doesn't already have it there:
rm -f node/bin/npx node/bin/npx.exe
tar c${REPACK_TAR_COMPRESSION_SWITCH}f "$UPLOAD_DIR"/node.$REPACK_SUFFIX node
|