Skip to content

Commit

Permalink
Merge pull request #117 from alecharp/JENKINS-57096
Browse files Browse the repository at this point in the history
[JENKINS-57096] Allow using Java 11 and Java 8 to run Jenkins on Debian / Ubuntu

(cherry picked from commit 9d7b708)
  • Loading branch information
oleg-nenashev authored and olivergondza committed May 7, 2019
1 parent 6253417 commit 3079f15
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions deb/build/debian/jenkins.init
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ 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
Expand Down Expand Up @@ -56,10 +54,12 @@ if [ -z "$JAVA" ]; then
exit 1
fi

# Which Java versions can be used to run Jenkins
JAVA_ALLOWED_VERSIONS=( "18" "110" )
# Work out the JAVA version we are working with:
JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;')
JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')

if [ "$JAVA_VERSION" = "$JAVA_ALLOWED_VERSION" ]; then
if [[ ${JAVA_ALLOWED_VERSIONS[*]} =~ "$JAVA_VERSION" ]]; then
echo "Correct java version found" >&2
else
echo "Found an incorrect Java version" >&2
Expand Down

0 comments on commit 3079f15

Please sign in to comment.