summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_wtstats
blob: 834b011110e14c058f4ff6dc471ca3f489fb6323 (plain)
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
#! /bin/sh

# Create wtstats.template.html file

t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15

# We require npm which may not be installed.
type npm > /dev/null 2>&1 || {
        echo 's_wtstats: npm not found' >&2
        echo '    npm is part of node.js from http://nodejs.org' >&2
        exit 1
}

cd ../tools/wtstats/template || exit 1

out=wtstats.html.template
rm -f $out

# Run npm install.
test -d ./node_modules || {
	echo 'Running: npm install'
	npm --quiet install >$t 2>&1 || {
		echo "s_wtstats: npm install failed" >&2
		cat $t
		exit 1
	}
}
echo 'Running: npm run build'
npm --quiet run build >$t 2>&1 || {
        echo "s_wtstats: npm run build failed" >&2
        cat $t
        exit 1
}
test -f $out || {
        echo "s_wtstats: $out not created" >&2
        cat $t
        exit 1
}

f=../$out
cmp $out $f > /dev/null 2>&1 ||
        (echo "Building $out" && rm -f $f && cp $out $f)
exit 0