]> git.wh0rd.org - home.git/blame - .bin/update-vapier-nodejs
add update-vapier-nodejs
[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'
16
17hash=$(curl -s "${URL_HASH_NODE}" | base64 -d)
18dir='node-linux-x64'
19cur_hash=$(cat "${dir}/hash" 2>/dev/null)
20if [[ ${cur_hash} != "${hash}" ]]; then
21 rm -rf "${dir}" "${cur_hash}"
22 wget -m -nd "${URL_GS_BASE}/6.9.4/${hash}"
23 echo "Unpacking ${hash} into ${dir}"
24 tar xf "${hash}"
25 echo "${hash}" >"${dir}/hash"
26fi
27
28ln -sfT "${dir}" current
29
30
31hash=$(curl -s "${URL_HASH_MOD}" | base64 -d)
32dir='node_modules'
33cur_hash=$(cat "${dir}/hash" 2>/dev/null)
34if [[ ${cur_hash} != "${hash}" ]]; then
35 rm -rf "${dir}" "${cur_hash}"
36 wget -m -nd "${URL_GS_BASE}/${hash}"
37 echo "Unpacking ${hash} into ${dir}"
38 tar xf "${hash}"
39 echo "${hash}" >"${dir}/hash"
40fi
41
42ln -sfT ../../node_modules/eslint/bin/eslint.js current/bin/eslint
43
44
45echo "Up-to-date now"
46
47
48exit 0
49# This is for nodejs directly.
50URL_BASE='https://nodejs.org/dist/latest-v6.x'
51SUMS='SHASUMS256.txt'
52URL_SUMS="${URL_BASE}/${SUMS}"
53
54wget -m -nd "${URL_SUMS}"
55
56read sum tar < <(grep 'linux-x64.tar.xz' "${SUMS}")
57dir=${tar%.tar.xz}
58
59URL_TAR="${URL_BASE}/${tar}"
60wget -m -nd "${URL_TAR}"
61
62if [[ ! -d ${dir} ]] ; then
63 tar xf "${tar}"
64 ln -sfT "${dir}" current
65fi