-
-
Notifications
You must be signed in to change notification settings - Fork 109
/
myrobotlab.sh
executable file
·67 lines (50 loc) · 1.83 KB
/
myrobotlab.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
REPO_FILE=libraries/repo.json
APPDIR="$(dirname -- ${0})"
echo APPDIR=${APPDIR}
CLASSPATH="${CLASSPATH}:${APPDIR}/target/classes/*:${APPDIR}/libraries/jar/*:${APPDIR}/myrobotlab.jar"
export CLASSPATH
echo CLASSPATH=${CLASSPATH}
# TODO move vars to top
# TODO have --id as an optional var
# TODO - option to package jdk for now use bin in path
JAVA=java
# if we decide to package the jvm
if [ -x "${APPDIR}/java/bin/java" ]; then
JAVA=${APPDIR}/java/bin/java
fi
# verify java exists
if type -p java; then
echo found java executable in PATH
_java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo found java executable in JAVA_HOME
_java="$JAVA_HOME/bin/java"
else
echo "java is not installed please install java 11 e.g. sudo apt install openjdk-11-jdk "
exit
fi
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
if [ "$JAVA_VER" -ge 11 ]; then
echo "found java version equal or greater to 11"
else
echo "incompatible version of java, java 11 required"
exit
fi
# Processing/Arduino handle this in an array - no need for now
JAVA_OPTIONS="-Djava.library.path=libraries/native -Djna.library.path=libraries/native -Dfile.encoding=UTF-8"
if (( $# > 0 ));
then
echo "USER SUPPLIED ARGS"
"${JAVA}" ${JAVA_OPTIONS} -cp ${CLASSPATH} org.myrobotlab.service.Runtime $@
exit
fi
# IS THIS VALID 2>&1 IF ALREADY GOING TO A LOG FILE - CYBER SAID SOME LOGGING WAS MISSING
if test -f "$REPO_FILE"; then
echo "$REPO_FILE exists."
else
echo "$REPO_FILE does not exist."
"${JAVA}" ${JAVA_OPTIONS} -cp ${CLASSPATH} org.myrobotlab.service.Runtime --install
fi
"${JAVA}" ${JAVA_OPTIONS} -cp ${CLASSPATH} org.myrobotlab.service.Runtime --log-level info -s log Log security Security webgui WebGui intro Intro python Python
echo $# $@