This repository was archived by the owner on Dec 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsign_node.sh
More file actions
executable file
·57 lines (43 loc) · 1.36 KB
/
sign_node.sh
File metadata and controls
executable file
·57 lines (43 loc) · 1.36 KB
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
#!/bin/bash
if [[ ${NODE_VERSION:-false} == false ]]; then
echo '${NODE_VERSION}' must be defined
exit 1
fi
if [[ ${S3_URL:-false} == false ]]; then
echo '${S3_URL}' must be defined
exit 1
fi
if [[ ${WINCERT_PASSWORD:-false} == false ]]; then
echo '${WINCERT_PASSWORD}' must be defined
exit 1
fi
if [ -n "$NAME" ]; then
S3_URL="$S3_URL/$NAME"
fi
set -e -u
TMP=/tmp/v${NODE_VERSION}-signing
mkdir -p ${TMP}/x64
# Download built node
aws s3 cp ${S3_URL}/v${NODE_VERSION}/node.exe ${TMP}/
aws s3 cp ${S3_URL}/v${NODE_VERSION}/x64/node.exe ${TMP}/x64/
# Download signing cert
aws s3 cp s3://mapbox/mapbox-studio/certs/authenticode.spc $TMP/authenticode.spc
aws s3 cp s3://mapbox/mapbox-studio/certs/authenticode.pvk $TMP/authenticode.pvk
# Install windowsign
npm install -g http://github.com/mapbox/windowsign/archive/v0.0.1.tar.gz
# Sign node.exe files
for FILE in $TMP/node.exe $TMP/x64/node.exe; do
N=node.js \
I=https://www.mapbox.com \
P=$WINCERT_PASSWORD \
SPC=$TMP/authenticode.spc \
PVK=$TMP/authenticode.pvk \
windowsign $FILE
done
# Remove signing certs
rm -f $TMP/authenticode.spc $TMP/authenticode.pvk
# Upload signed versions
aws s3 cp --acl=public-read $TMP/node.exe ${S3_URL}/v${NODE_VERSION}/node.exe
aws s3 cp --acl=public-read $TMP/x64/node.exe ${S3_URL}/v${NODE_VERSION}/x64/node.exe
# Cleanup
rm -rf $TMP