(MODULES-2971) Add java_home to all operating systems
This patch adds the java_home variable to all supported operating systemd, and gives the user the option to set it themselves. It also updates config.pp to ensure that the JAVA_HOME variable is set to the desired java_home.
This commit is contained in:
@@ -35,6 +35,10 @@
|
||||
# alternative is actually enabled, this is required to ensure the
|
||||
# correct JVM is enabled.
|
||||
#
|
||||
# [*java_home*]
|
||||
# The path to where the JRE is installed. This will be set as an
|
||||
# environment variable.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
@@ -47,7 +51,8 @@ class java(
|
||||
$package = undef,
|
||||
$package_options = undef,
|
||||
$java_alternative = undef,
|
||||
$java_alternative_path = undef
|
||||
$java_alternative_path = undef,
|
||||
$java_home = undef
|
||||
) {
|
||||
include java::params
|
||||
|
||||
@@ -61,7 +66,7 @@ class java(
|
||||
$default_package_name = $java::params::java[$distribution]['package']
|
||||
$default_alternative = $java::params::java[$distribution]['alternative']
|
||||
$default_alternative_path = $java::params::java[$distribution]['alternative_path']
|
||||
$java_home = $java::params::java[$distribution]['java_home']
|
||||
$default_java_home = $java::params::java[$distribution]['java_home']
|
||||
} else {
|
||||
fail("Java distribution ${distribution} is not supported.")
|
||||
}
|
||||
@@ -91,6 +96,14 @@ class java(
|
||||
default => $java_alternative_path,
|
||||
}
|
||||
|
||||
$use_java_home = $java_home ? {
|
||||
undef => $use_java_package_name ? {
|
||||
$default_package_name => $default_java_home,
|
||||
default => undef,
|
||||
},
|
||||
default => $java_home,
|
||||
}
|
||||
|
||||
$jre_flag = $use_java_package_name ? {
|
||||
/headless/ => '--jre-headless',
|
||||
default => '--jre'
|
||||
|
||||
Reference in New Issue
Block a user