OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 | |
3 # Copyright 2017 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 # Script for updating Node binaries. | |
8 # 1) Update NODE_VERSION variable below to the desired version. | |
9 # 2) Run this script. | |
10 # 3) Upload the binaries to the Google Storage bucket (commands to upload | |
11 # binaries are printed at step 2, look for "gsutil.py"). | |
12 # 4) Land a CL with the changes generated by this script. | |
13 | |
14 cd "$(dirname "$0")" | |
15 | |
16 BASE_URL="https://nodejs.org/dist" | |
17 NODE_VERSION="v6.9.4" | |
18 | |
19 ####################################### | |
20 # Updates Node binary for Mac | |
21 ####################################### | |
22 update_mac() { | |
23 local SUFFIX="darwin-x64" | |
24 local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.gz" | |
25 local FOLDER="mac" | |
26 local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}" | |
27 rm -f "${FOLDER}/${FILENAME}" | |
28 wget -P "${FOLDER}/" "${URL}" | |
palmer
2017/01/13 01:02:27
Might be good to check if wget fails, for whatever
M-A Ruel
2017/01/13 02:25:04
I highly recomment "set -eu". It's more annoying t
dpapad
2017/01/13 03:28:10
Done.
| |
29 | |
30 # Unpack temporarily, delete NPM symlink and re-pack. | |
31 tar xfz "${FOLDER}/${FILENAME}" -C "${FOLDER}/" | |
32 rm "${FOLDER}/${FILENAME}" | |
33 rm "${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm" | |
34 | |
35 # Drop the version info from the name, since it is redundant and would make | |
36 # rolling new versions more involved. | |
37 mv "${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/" "${FOLDER}/node-${SUFFIX}/" | |
38 tar cfz "${FOLDER}/node-${SUFFIX}.tar.gz" -C "${FOLDER}" "node-${SUFFIX}/" | |
39 local sha1 | |
40 sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)" | |
41 echo "${sha1}" > "${FOLDER}/node-${SUFFIX}.tar.gz.sha1" | |
palmer
2017/01/13 01:02:28
Maybe check the checksum that Node distributes? E.
dpapad
2017/01/13 03:28:10
It's download_from_google_storage script that requ
| |
42 echo "Please execute manually the following:" | |
43 echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NO DE_VERSION:1}/${sha1}" | |
44 echo "DONE updating Mac." | |
45 } | |
46 | |
47 ####################################### | |
48 # Updates Node binary for Linux | |
49 ####################################### | |
50 update_linux() { | |
51 local SUFFIX="linux-x64" | |
52 local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.xz" | |
53 local FOLDER="linux" | |
54 local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}" | |
55 rm -f "${FOLDER}/${FILENAME}" | |
56 wget -P "${FOLDER}/" "${URL}" | |
57 | |
58 # Unpack temporarily, delete NPM symlink and re-pack as gz (not xz). | |
59 tar xf "${FOLDER}/${FILENAME}" -C "${FOLDER}/" | |
60 rm "${FOLDER}/${FILENAME}" | |
61 rm "${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm" | |
62 | |
63 # Drop the version info from the name, since it is redundant and would make | |
64 # rolling new versions more involved. | |
65 mv "${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/" "${FOLDER}/node-${SUFFIX}/" | |
66 tar cfz "${FOLDER}/node-${SUFFIX}.tar.gz" -C "${FOLDER}" "node-${SUFFIX}/" | |
67 local sha1 | |
68 sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)" | |
69 echo "${sha1}" > "${FOLDER}/node-${SUFFIX}.tar.gz.sha1" | |
70 echo "Please execute manually the following:" | |
71 echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NO DE_VERSION:1}/${sha1}" | |
72 echo "DONE updating Linux." | |
73 } | |
74 | |
75 ####################################### | |
76 # Updates Node binary for Windows | |
77 ####################################### | |
palmer
2017/01/13 01:02:27
Nit: I'd argue these comment blocks are unnecessar
dpapad
2017/01/13 03:28:10
Removed.
| |
78 update_win() { | |
79 local FILENAME="node.exe" | |
80 local FOLDER="win" | |
81 local WINDOWS_URL="${BASE_URL}/${NODE_VERSION}/win-x64/${FILENAME}" | |
82 rm -f "${FOLDER}/${FILENAME}" | |
83 wget -P "${FOLDER}/" "${WINDOWS_URL}" | |
84 local sha1 | |
85 sha1="$(sha1sum ${FOLDER}/node.exe | cut -d ' ' -f1)" | |
86 echo "${sha1}" > "${FOLDER}/node.exe.sha1" | |
87 echo "Please execute manually the following:" | |
88 echo "> gsutil.py cp ${FOLDER}/node.exe gs://chromium-nodejs/${NODE_VERSION:1} /${sha1}" | |
89 echo "DONE updating Windows." | |
90 } | |
91 | |
92 update_linux | |
93 update_mac | |
94 update_win | |
95 | |
96 # Update DEPS to point to the new Google Storage bucket subfolder. | |
97 sed -i "s@\(chromium-nodejs/\)\([0-9\.]\)\+@\1${NODE_VERSION:1}@" ../../DEPS | |
OLD | NEW |