forked from duniter/duniter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduniter.sh
executable file
·52 lines (39 loc) · 836 Bytes
/
duniter.sh
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
#!/bin/bash
##########################
# DUNITER EXECUTABLE
#
# Wraps bin/duniter that is called with Node.js
#
DEB_PACKAGING=
if [[ $DEB_PACKAGING ]]; then
DUNITER_DIR=/opt/duniter/
fi
duniter() {
local NODE
local LOGS_FILE
if [ -z "$DEV_MODE" ]; then
### Production mode
if [[ -d $DUNITER_DIR/node ]]; then
NODE=$DUNITER_DIR/node/bin/node
else
echo "Node.js is not embedded in this version of Duniter"
return
fi;
else
### Cheating with DEV mode
DUNITER_DIR=`pwd`
NODE=node
fi
VERSION=`$NODE -v`
if [[ $VERSION != v10* ]]; then
echo "$NODE v10 is required";
else
# Calls duniter JS command
cd $DUNITER_DIR
$NODE "$DUNITER_DIR/bin/duniter" "$@"
fi;
}
# If the script was launched with parameters, try to launch the Duniter command
if [ ! -z $1 ]; then
duniter "$@"
fi