class SyncWrap::CommercialJDK
Provision a Commmercial (i.e. Oracle) JDK or “Server JRE” (jrs_) via an HTTP accessable binary repository of your making. Commercial usage terms generally preclude sharing a public binary repository for these. Given the size, check-in or pushing from a development workstation is likely also a bad idea, though not difficult to implement.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Host component dependencies: <Distro>
Attributes
An optional cryptographic hash value (hexadecimal, some standard length) to use for verifying the 'jdk_name.tar.gz' package. Default: nil (no verification)
HTTP URL to repo base directory. Note that the default (localhost/repo) is unlikely to work here.
The name of the JDK, which is used for download via java_repo_base_url/<name>.tar.gz and the expected top level directory when unpackaged.
Public Class Methods
# File lib/syncwrap/components/commercial_jdk.rb, line 50 def initialize( opts = {} ) @java_repo_base_url = 'http://localhost/repo' @jdk_name = 'jrs-ora-1.7.0_51-x64' @hash = nil super end
Public Instance Methods
# File lib/syncwrap/components/commercial_jdk.rb, line 67 def install distro = "/tmp/#{jdk_name}.tar.gz" bins = %w[ java jmap jstack jstat jps jinfo jhat javac ]. map { |b| "../lib/java/bin/#{b}" }. join( ' ' ) sudo_if( "[ ! -d #{jdk_dir} ]" ) do dist_install( 'curl', minimal: true, check_install: true ) sudo <<-SH curl -sSL -o #{distro} #{jdk_url} SH hash_verify( hash, distro, user: :root ) if hash sudo <<-SH tar -C #{local_root}/lib -zxf #{distro} rm -f #{distro} cd #{local_root}/lib && ln -sfn #{jdk_name} java cd #{local_root}/bin && ln -sfn #{bins} . SH end end
Local jdk directory, within local_root, to be installed
# File lib/syncwrap/components/commercial_jdk.rb, line 63 def jdk_dir "#{local_root}/lib/#{jdk_name}" end
Complete URL to the jdk tarball within the java/binary repo
# File lib/syncwrap/components/commercial_jdk.rb, line 58 def jdk_url File.join( @java_repo_base_url, @jdk_name + '.tar.gz' ) end