From db5ca26e3d01dddf8186a2920c2f91337fbd2906 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Wed, 9 May 2018 14:24:20 +0200 Subject: [PATCH] sync file from the newest jenkins 2.107.3 package Signed-off-by: Mattia Rizzolo --- hosts/jenkins/etc/init.d/jenkins | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/hosts/jenkins/etc/init.d/jenkins b/hosts/jenkins/etc/init.d/jenkins index 076151e41..8bde1b5e7 100755 --- a/hosts/jenkins/etc/init.d/jenkins +++ b/hosts/jenkins/etc/init.d/jenkins @@ -24,10 +24,16 @@ SCRIPTNAME=/etc/init.d/$NAME #DAEMON=$JENKINS_SH DAEMON=/usr/bin/daemon DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=$JENKINS_HOME --output=$JENKINS_LOG --pidfile=$PIDFILE" +JAVA=`type -p java` + +JAVA_ALLOWED_VERSION="18" if [ -n "$UMASK" ]; then DAEMON_ARGS="$DAEMON_ARGS --umask=$UMASK" fi +if [ "$JENKINS_ENABLE_ACCESS_LOG" = "yes" ]; then + DAEMON_ARGS="$DAEMON_ARGS --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/log/$NAME/access_log" +fi SU=/bin/su @@ -43,6 +49,26 @@ if [ "$RUN_STANDALONE" = "false" ]; then exit 1 fi +# Make sure there exists a java executable, it may not be allways the case +if [ -z "$JAVA" ]; then + echo "ERROR: No Java executable found in current PATH: $PATH" >&2 + echo "If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' returns the java executable path" >&2 + exit 1 +fi + +# Work out the JAVA version we are working with: +JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;') + +if [ "$JAVA_VERSION" = "$JAVA_ALLOWED_VERSION" ]; then + echo "Correct java version found" >&2 +else + echo "Found an incorrect Java version" >&2 + echo "Java version found:" >&2 + echo $($JAVA -version) >&2 + echo "Aborting" >&2 + exit 1 +fi + # load environments if [ -r /etc/default/locale ]; then . /etc/default/locale -- GitLab