Skip to content

Commit

Permalink
Add die message function to setenv (#496)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Clark <ben@benjyc.uk>
  • Loading branch information
BClark09 authored and kaikreuzer committed Jul 28, 2017
1 parent c75c06a commit 040b5ba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions distributions/openhab/src/main/resources/bin/setenv
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ export EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS_COMMON} ${EXTRA_JAVA_OPTS_ARCH} ${EXTR
# The functions below are copied from the karaf script to set JAVA_HOME to a default value.
# This avoids Karaf printing a warning message at startup.

die() {
# echo and exit, && /bin/true delays the exit for systemd logging (workaround).
echo "$*" && /bin/true
exit 1
}

detectOS() {
# OS specific support (must be 'true' or 'false').
cygwin=false;
Expand Down Expand Up @@ -190,8 +196,7 @@ locateJava() {
checkJvmVersion() {
VERSION=`$JAVA -version 2>&1 | egrep '"([0-9].[0-9]\..*[0-9]).*"' | awk '{print substr($3,2,length($3)-2)}' | awk '{print substr($1, 3, 3)}' | sed -e 's;\.;;g'`
if [ "$VERSION" -lt "80" ]; then
echo "Java 1.8 or higher is required. Aborting launch."
exit 1;
die "Java 1.8 or higher is required. Aborting launch."
fi
}

Expand Down

0 comments on commit 040b5ba

Please sign in to comment.