-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating check-java.sh and server.xml templates to current upstream v…
…ersion
- Loading branch information
Showing
3 changed files
with
70 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,59 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
# This file is managed by Puppet | ||
|
||
# This file should be identical to 'check-java.sh' in the Jira 7.0.4 standalone | ||
# tarball. | ||
|
||
_EXPECTED_JAVA_VERSION="8" | ||
# | ||
# This file is nearly identical to 'check-java.sh' in the Jira 8.15.0 standalone tarball. Shebang was changed to bash | ||
# (does not need to stay /bin/sh, since it is called by catalina.sh, which itself has /bin/bash as shebang) to allow | ||
# bashisms. Also errors detected by shellcheck were fixed . | ||
|
||
# | ||
# check for correct java version by parsing out put of java -version | ||
# we expect first line to be in format 'java version "1.8.0_40"' and assert that minor version number will be 8 or higher | ||
# we expect first line to be in format 'java version "1.8.0_161"' or 'java version "10.0.1" 2018-04-17' | ||
# or 'openjdk version "11-ea" 2018-09-25' and assert that version number will be 8 or 11 (if enabled) | ||
# or sth like 'Picked up JDK_JAVA_OPTIONS:' (which we need to skip) | ||
# | ||
|
||
"$_RUNJAVA" -version 2>&1 | grep "java version" | ( | ||
IFS=. read ignore1 version ignore2 | ||
if [ ! ${version:-0} -ge "$_EXPECTED_JAVA_VERSION" ] | ||
then | ||
echo "*************************************************************************************************************************************" | ||
echo "********** Wrong JVM version! You are running with "$ignore1"."$version"."$ignore2" but JIRA requires at least 1.8 to run. **********" | ||
echo "*************************************************************************************************************************************" | ||
exit 1 | ||
fi | ||
) | ||
if [ $? -ne 0 ] ; then | ||
exit 1 | ||
java_raw_version=$($_RUNJAVA -version 2>&1 | grep -v "JDK_JAVA_OPTIONS" | grep "version" | awk '{ print substr($3, 2, length($3)-2); }') | ||
java_version=0 | ||
|
||
if [[ $java_raw_version = *-ea* ]] | ||
then | ||
# early access format e.g 11-ea | ||
IFS='-' read -ra values <<< "$java_raw_version" | ||
java_version=${values[0]} | ||
else | ||
if [[ $java_raw_version = 1.* ]] | ||
then | ||
# old format e.g. 1.8.0_161 | ||
IFS='.' read -ra values <<< "$java_raw_version" | ||
java_version=${values[1]} | ||
else | ||
# new format e.g. 10.0.1 | ||
IFS='.' read -ra values <<< "$java_raw_version" | ||
java_version=${values[0]} | ||
fi | ||
fi | ||
|
||
if [ "$java_version" -ne 8 ] && [ "$java_version" -ne 11 ] | ||
then | ||
echo "****************************************************************************" | ||
echo "******* Wrong JVM version! Jira requires 1.8 or 11 to run. *******" | ||
echo "****************************************************************************" | ||
echo "***" | ||
echo "*** Output of java -version command is:" | ||
$_RUNJAVA -version 2>&1 | ||
echo "*** (End of output) ***" | ||
echo "***" | ||
if [ "$ignore_jvm_version" = "true" ] | ||
then | ||
echo "*** Environment variable 'ignore_jvm_version' is set to 'true'" | ||
echo "*** Jira is going to bypass restriction and run using existing JVM version" | ||
echo "***" | ||
echo "****************************************************************************" | ||
else | ||
echo "*** If you want Jira to start using this JVM" | ||
echo "*** set environment variable 'ignore_jvm_version' to 'true'" | ||
echo "***" | ||
echo "****************************************************************************" | ||
exit 1 | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters