Files
puppetlabs-java/manifests/config.pp
Sebastian Reitenbach bdfc567c18 OpenBSD doesn't have /etc/environment, therefore there is no
need to fiddle with it. The default case statement, "do nothing"
is all fine here.

Facter::Util::Resolution.with_env is long time gone since
Facter > 2.x. That was even longer before introduced by me.
Remove that OpenBSD special case in the java_version fact,
and assume that $PATH is properly set in order to find
the 'java' binary.

Additionally confine the java_default_home and java_libjvm_path
to OpenBSD kernel as well. Add some flesh to the java_default_home
fact to allow it to find the java binary.
2017-11-15 14:37:42 +00:00

79 lines
2.8 KiB
Puppet

# On Debian systems, if alternatives are set, manually assign them.
class java::config ( ) {
case $::osfamily {
'Debian': {
if $java::use_java_alternative != undef and $java::use_java_alternative_path != undef {
exec { 'update-java-alternatives':
path => '/usr/bin:/usr/sbin:/bin:/sbin',
command => "update-java-alternatives --set ${java::use_java_alternative} ${java::jre_flag}",
unless => "test /etc/alternatives/java -ef '${java::use_java_alternative_path}'",
}
}
if $java::use_java_home != undef {
file_line { 'java-home-environment':
path => '/etc/environment',
line => "JAVA_HOME=${$java::use_java_home}",
match => 'JAVA_HOME=',
}
}
}
'RedHat': {
if $java::use_java_alternative != undef and $java::use_java_alternative_path != undef {
# The standard packages install alternatives, custom packages do not
# For the stanard packages java::params needs these added.
if $java::use_java_package_name != $java::default_package_name {
exec { 'create-java-alternatives':
path => '/usr/bin:/usr/sbin:/bin:/sbin',
command => "alternatives --install /usr/bin/java java ${$java::use_java_alternative_path} 20000" ,
unless => "alternatives --display java | grep -q ${$java::use_java_alternative_path}",
before => Exec['update-java-alternatives']
}
}
exec { 'update-java-alternatives':
path => '/usr/bin:/usr/sbin',
command => "alternatives --set java ${$java::use_java_alternative_path}" ,
unless => "test /etc/alternatives/java -ef '${java::use_java_alternative_path}'",
}
}
if $java::use_java_home != undef {
file_line { 'java-home-environment':
path => '/etc/environment',
line => "JAVA_HOME=${$java::use_java_home}",
match => 'JAVA_HOME=',
}
}
}
'FreeBSD', 'Suse': {
if $java::use_java_home != undef {
file_line { 'java-home-environment':
path => '/etc/environment',
line => "JAVA_HOME=${$java::use_java_home}",
match => 'JAVA_HOME=',
}
}
}
'Solaris': {
if $java::use_java_home != undef {
file_line { 'java-home-environment':
path => '/etc/profile',
line => "JAVA_HOME=${$java::use_java_home}",
match => 'JAVA_HOME=',
}
}
}
'Archlinux': {
if $java::use_java_home != undef {
file_line { 'java-home-environment':
path => '/etc/profile',
line => "JAVA_HOME=${$java::use_java_home}",
match => 'JAVA_HOME=',
}
}
}
default: {
# Do nothing.
}
}
}