Skip to content

Commit 66a5c9d

Browse files
author
foo
committed
Check nodejs version when restarting demo
1 parent 9e7513c commit 66a5c9d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

demos/restart_demo.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
set -ex
44

5+
6+
NODE_MAJOR_VERSION=`node --version | cut -d'.' -f 1 | cut -d'v' -f 2`
7+
8+
test_node_version () {
9+
MAJOR_VERSION_RE='^[0-9]+$'
10+
# checks if a version exists
11+
if ! [[ $1 =~ $MAJOR_VERSION_RE ]] ; then
12+
echo "Nodejs seems not installed. This requires nodejs>=14 to continue" >&2; exit 1
13+
fi
14+
# checks if the version is 14 or more
15+
if [ $1 -lt 14 ]; then
16+
echo "Nodejs version must be 14 or more, current is $1">&2; exit 1
17+
fi
18+
}
19+
20+
test_node_version ${NODE_MAJOR_VERSION}
21+
522
# Configuration variables.
623
root="$(realpath `dirname $0`)"
724
srv_root="/srv/nbgrader"

0 commit comments

Comments
 (0)