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.
26 lines
590 B
Ruby
26 lines
590 B
Ruby
# Fact: java_libjvm_path
|
|
#
|
|
# Purpose: get path to libjvm.so
|
|
#
|
|
# Resolution:
|
|
# Lists file in java default home and searches for the file
|
|
#
|
|
# Caveats:
|
|
# Needs to list files recursively. Returns the first match
|
|
#
|
|
# Notes:
|
|
# None
|
|
Facter.add(:java_libjvm_path) do
|
|
confine :kernel => [ "Linux", "OpenBSD" ]
|
|
setcode do
|
|
java_default_home = Facter.value(:java_default_home)
|
|
java_libjvm_file = Dir.glob("#{java_default_home}/jre/lib/**/libjvm.so")
|
|
if java_libjvm_file.nil? || java_libjvm_file.empty?
|
|
nil
|
|
else
|
|
File.dirname(java_libjvm_file[0])
|
|
end
|
|
end
|
|
end
|
|
|