2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'manifests/config.pp', line 2
class java::config ( ) {
case $facts['os']['family'] {
'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=',
}
}
}
'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=',
}
}
}
'FreeBSD': {
if $java::use_java_home != undef {
file_line { 'java-home-environment-profile':
path => '/etc/profile',
line => "JAVA_HOME=${$java::use_java_home}; export JAVA_HOME",
match => 'JAVA_HOME=',
}
file_line { 'java-home-environment-cshrc':
path => '/etc/csh.login',
line => "setenv JAVA_HOME ${$java::use_java_home}",
match => 'setenv 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.
}
}
}
|