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