-
Notifications
You must be signed in to change notification settings - Fork 272
(MODULES-2971) Add java_home to all operating systems #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,13 @@ | |
| 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=', | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think this is exactly what
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed it is, updated the PR. |
||
| } | ||
| } | ||
| 'RedHat': { | ||
| if $java::use_java_alternative != undef and $java::use_java_alternative_path != undef { | ||
|
|
@@ -29,6 +36,49 @@ | |
| 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=', | ||
| } | ||
| } | ||
| } | ||
| 'OpenBSD': { | ||
| 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': | ||
| 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=', | ||
| } | ||
| } | ||
| } | ||
| 'Solaris': { | ||
| if $java::use_java_home != undef { | ||
| file_line { 'java-home-environment': | ||
| path => '/etc/environment', | ||
| line => "JAVA_HOME=${$java::use_java_home}", | ||
| match => 'JAVA_HOME=', | ||
| } | ||
| } | ||
| } | ||
| default: { | ||
| # Do nothing. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would say "look for a match of
JAVA_HOME=and if found then assume it is updated. This would cause file_line to update the environment once and never again.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the file_line documentation, it looks like 'replace' defaults to true, which would mean if a match is found the current implementation would be to replace it with the updated java home for the environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. It looks for that line to replace instead of adding the new one, but looks for
lineexactly already.