]>
Commit | Line | Data |
---|---|---|
227530ea MF |
1 | #!/bin/bash |
2 | ||
3 | # Update node install & modules from Chromium project. | |
4 | ||
5 | set -e | |
6 | ||
7 | cd /usr/local/src/chrome-ext | |
8 | if [[ ! -d nodejs ]]; then | |
9 | mkdir nodejs | |
10 | fi | |
11 | cd nodejs | |
12 | ||
13 | URL_GS_BASE='https://storage.googleapis.com/chromium-nodejs' | |
14 | URL_HASH_NODE='https://chromium.googlesource.com/chromium/src/+/master/third_party/node/linux/node-linux-x64.tar.gz.sha1?format=TEXT' | |
15 | URL_HASH_MOD='https://chromium.googlesource.com/chromium/src/+/master/third_party/node/node_modules.tar.gz.sha1?format=TEXT' | |
eed0ff40 MF |
16 | # TODO: Find source of truth for this. |
17 | VER="8.9.1" | |
227530ea MF |
18 | |
19 | hash=$(curl -s "${URL_HASH_NODE}" | base64 -d) | |
20 | dir='node-linux-x64' | |
eed0ff40 | 21 | cur_hash=$(cat "${dir}/hash" 2>/dev/null || :) |
227530ea MF |
22 | if [[ ${cur_hash} != "${hash}" ]]; then |
23 | rm -rf "${dir}" "${cur_hash}" | |
eed0ff40 | 24 | wget -m -nd "${URL_GS_BASE}/${VER}/${hash}" |
227530ea MF |
25 | echo "Unpacking ${hash} into ${dir}" |
26 | tar xf "${hash}" | |
27 | echo "${hash}" >"${dir}/hash" | |
28 | fi | |
29 | ||
30 | ln -sfT "${dir}" current | |
31 | ||
32 | ||
33 | hash=$(curl -s "${URL_HASH_MOD}" | base64 -d) | |
34 | dir='node_modules' | |
eed0ff40 | 35 | cur_hash=$(cat "${dir}/hash" 2>/dev/null || :) |
227530ea MF |
36 | if [[ ${cur_hash} != "${hash}" ]]; then |
37 | rm -rf "${dir}" "${cur_hash}" | |
38 | wget -m -nd "${URL_GS_BASE}/${hash}" | |
39 | echo "Unpacking ${hash} into ${dir}" | |
40 | tar xf "${hash}" | |
41 | echo "${hash}" >"${dir}/hash" | |
42 | fi | |
43 | ||
44 | ln -sfT ../../node_modules/eslint/bin/eslint.js current/bin/eslint | |
45 | ||
46 | ||
47 | echo "Up-to-date now" | |
48 | ||
49 | ||
50 | exit 0 | |
51 | # This is for nodejs directly. | |
52 | URL_BASE='https://nodejs.org/dist/latest-v6.x' | |
53 | SUMS='SHASUMS256.txt' | |
54 | URL_SUMS="${URL_BASE}/${SUMS}" | |
55 | ||
56 | wget -m -nd "${URL_SUMS}" | |
57 | ||
58 | read sum tar < <(grep 'linux-x64.tar.xz' "${SUMS}") | |
59 | dir=${tar%.tar.xz} | |
60 | ||
61 | URL_TAR="${URL_BASE}/${tar}" | |
62 | wget -m -nd "${URL_TAR}" | |
63 | ||
64 | if [[ ! -d ${dir} ]] ; then | |
65 | tar xf "${tar}" | |
66 | ln -sfT "${dir}" current | |
67 | fi |