diff --git a/README.md b/README.md deleted file mode 100644 index 6577b1d..0000000 --- a/README.md +++ /dev/null @@ -1,187 +0,0 @@ -Description -=========== - -Installs a Java. Uses OpenJDK by default but supports installation of Oracle's JDK. - -This cookbook also provides the `java_ark` LWRP which other java -cookbooks can use to install java-related applications from binary -packages. - -The `java_ark` LWPR may move to its own cookbook at some point in the -future as its functionality is useful for other purposes. - -Requirements -============ - -Platform --------- - -* Debian, Ubuntu -* CentOS, Red Hat, Fedora, Scientific, Amazon -* ArchLinux -* FreeBSD - -Attributes -========== - -See `attributes/default.rb` for default values. - -* `node["java"]["install_flavor"]` - Flavor of JVM you would like installed (`oracle` or `openjdk`), default `openjdk`. -* `node['java']['java_home']` - Default location of the "`$JAVA_HOME`". -* `node['java']['tarball']` - name of the tarball to retrieve from your corporate repository default `jdk1.6.0_29_i386.tar.gz` -* `node['java']['tarball_checksum']` - checksum for the tarball, if you use a different tarball, you also need to create a new sha256 checksum -* `node['java']['jdk']` - version and architecture specific attributes - for setting the URL on Oracle's site for the JDK, and the checksum - of the .tar.gz. - -Recipes -======= - -default -------- - -Include the default recipe in a run list, to get `java`. By default -the `openjdk` flavor of Java is installed, but this can be changed by -using the `install_flavor` attribute. - -OpenJDK is the default because of licensing changes made upstream by -Oracle. See notes on the `oracle` recipe below. - -openjdk -------- - -This recipe installs the `openjdk` flavor of Java. - -oracle ------- - -This recipe installs the `oracle` flavor of Java. This recipe does not -use distribution packages as Oracle changed the licensing terms with -JDK 1.6u27 and prohibited the practice for both the debian and EL worlds. - -For both debian and centos/rhel, this recipe pulls the binary -distribution from the Oracle website, and installs it in the default -JAVA_HOME for each distribution. For debian/ubuntu, this is -/usr/lib/jvm/default-java. For Centos/RHEL, this is /usr/lib/jvm/java - -After putting the binaries in place, the oracle recipe updates -/usr/bin/java to point to the installed JDK using the -`update-alternatives` script - -oracle_i386 ------------ - -This recipe installs the 32-bit Java virtual machine without setting -it as the default. This can be useful if you have applications on the -same machine that require different versions of the JVM. - -Resources/Providers -=================== - -This LWRP provides an easy way to manage java applications. It uses -the LWRP arkive (deliberately misspelled). It is an arkive and not an -"archive" because the `java_ark` lwrp is not the same as a java -archive or "jar". Essentially, you provide the `java_ark` with the URL -to a tarball and the commands within the extracted result that you -want symlinked to /usr/bin/ - -The `java_ark` LWPR may move to its own cookbook at some point in the -future as its functionality is useful for other purposes. - -By default, the extracted directory is extracted to -`app_root/extracted_dir_name` and symlinked to `app_root/default` - -# Actions - -- `:install`: extracts the tarball and makes necessary symlinks -- `:remove`: removes the tarball and run update-alternatives for all - symlinked `bin_cmds` - -# Attribute Parameters - -- `url`: path to tarball, .tar.gz, .bin (oracle-specific), and .zip - currently supported -- `checksum`: sha256 checksum, not used for security but avoid - redownloading the archive on each chef-client run -- `app_home`: the default for installations of this type of - application, for example, `/usr/lib/tomcat/default`. If your - application is not set to the default, it will be placed at the same - level in the directory hierarchy but the directory name will be - `app_root/extracted_directory_name + "_alt"` -- `app_home_mode`: file mode for app_home, is an integer -- `bin_cmds`: array of binary commands that should be symlinked to - /usr/bin, examples are mvn, java, javac, etc. These cmds must be in - the bin/ subdirectory of the extracted folder. Will be ignored if this - java_ark is not the default -- `owner`: owner of extracted directory, set to "root" by default -- `default`: whether this the default installation of this package, - boolean true or false - - -# Examples - - # install jdk6 from Oracle - java_ark "jdk" do - url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin' - checksum 'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365' - app_home '/usr/local/java/default' - bin_cmds ["java", "javac"] - action :install - end - - # installs maven2 - java_ark "maven2" do - url "http://www.apache.org/dist/maven/binaries/apache-maven-2.2.1-bin.tar.gz" - checksum "b9a36559486a862abfc7fb2064fd1429f20333caae95ac51215d06d72c02d376" - app_home "/usr/local/maven/default" - bin_cmds ["mvn"] - action :install - end - -Usage -===== - -Simply include the `java` recipe where ever you would like Java installed. - -To install Oracle flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role: - - name "java" - description "Install Oracle Java on Ubuntu" - override_attributes( - "java" => { - "install_flavor" => "oracle" - } - ) - run_list( - "recipe[java]" - ) - -Changes -======= - -## v1.4.0: - -* [COOK-858] - numerous updates: handle jdk6 and 7, switch from sun to - oracle, make openjdk default, add `java_ark` LWRP. -* [COOK-942] - FreeBSD support -* [COOK-520] - ArchLinux support - -License and Author -================== - -Author:: Seth Chisamore () -Author:: Bryan W. Berry () - -Copyright:: 2008-2012, Opscode, Inc - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..8e9d148 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,29 @@ += DESCRIPTION: + +Installs Java and Ant. + += REQUIREMENTS: + +Platform: Ubuntu, Debian, Red Hat, CentOS, Fedora. + +Enable the 'multiverse' repository on Ubuntu, 'non-free' on Debian or EPEL on RH/Cent/Fedora to get the Java package, or edit the default recipe to point at the Java package for your platform. + += USAGE: + +Simply include the recipe where you want Java installed. Note the respository requirement above to get the right package. On Debian and Ubuntu systems, the recipe will preseed the package and update java alternaties. + += LICENSE and AUTHOR: + +Copyright 2008-2010, Opscode, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/attributes/default.rb b/attributes/default.rb deleted file mode 100644 index 93d4b3d..0000000 --- a/attributes/default.rb +++ /dev/null @@ -1,52 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook Name:: java -# Attributes:: ark -# -# Copyright 2010, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# default jdk attributes -default['java']['install_flavor'] = "openjdk" -default['java']['jdk_version'] = '6' -default['java']['arch'] = kernel['machine'] =~ /x86_64/ ? "x86_64" : "i586" - -case platform -when "centos","redhat","fedora" - default['java']['java_home'] = "/usr/lib/jvm/java" -when "freebsd" - default['java']['java_home'] = "/usr/local/openjdk#{java['jdk_version']}" -when "arch" - default['java']['java_home'] = "//usr/lib/jvm/java-#{java['jdk_version']}-openjdk" -else - default['java']['java_home'] = "/usr/lib/jvm/default-java" -end - -# jdk6 attributes -# x86_64 -default['java']['jdk']['6']['x86_64']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-linux-x64.bin' -default['java']['jdk']['6']['x86_64']['checksum'] = '928220f4e46c5dabef0440791c48023945629d8a23998e072157e04960d8a759' - -# i586 -default['java']['jdk']['6']['i586']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-linux-i586.bin' -default['java']['jdk']['6']['i586']['checksum'] = 'b551be83a690bc9fec0107d9aa4f828cd47e150fa54cbedbfa8f80c99e2f18b5' - -# jdk7 attributes -# x86_64 -default['java']['jdk']['7']['x86_64']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.tar.gz' -default['java']['jdk']['7']['x86_64']['checksum'] = '411a204122c5e45876d6edae1a031b718c01e6175833740b406e8aafc37bc82d' - -# i586 -default['java']['jdk']['7']['i586']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz' -default['java']['jdk']['7']['i586']['checksum'] = '74faad48fef2c368276dbd1fd6c02520b0e9ebdcb1621916c1af345fc3ba65d1' diff --git a/cc.gemspec b/cc.gemspec new file mode 100644 index 0000000..5f71531 --- /dev/null +++ b/cc.gemspec @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- +lib = File.expand_path('../',__FILE__) +lib_up = File.expand_path('../../', __FILE__) +$:.unshift lib unless $:.include?(lib) +$:.unshift lib_up unless $:.include?(lib_up) +require 'json' + +ENV['GEM_PATH']=ENV['BUNDLE_INSTALL_PATH'] if ENV['BUNDLE_INSTALL_PATH'] +ENV['GEM_HOME']=ENV['BUNDLE_INSTALL_PATH'] if ENV['BUNDLE_INSTALL_PATH'] + +name = File.split(lib)[-1]||"" +raise ArgumentError, '', caller if name.empty? +@name=name + +Gem.use_paths(ENV['BUNDLE_INSTALL_PATH'],[]) if ENV['BUNDLE_INSTALL_PATH'] + +Gem::Specification.new do |s| + + md = JSON.parse(File.read(File.expand_path('../metadata.json', __FILE__))) + + # Required attributes (gem build fails without these) + s.name = @name + s.version = md['version'] && !md['version'].empty? ? md['version'] : '0' + s.files = Dir.glob('**/*') #.map{|f| File.expand_path(f)} + s.summary = md['description'] ? md['description'] : "The Chef cookbook for #{s.name}" + + # Optional attributes (gem build warning raised without these) + s.author = md['maintainer'] ? md['maintainer'] : 'No acknowledged maintainer' + s.description = md['long_description'] ? md['long_description'] : s.summary + s.email = md['maintainer_email'] ? md['maintainer_email'] : 'No acknowledged maintainer email' + s.homepage = 'http://www.opscode.com' + md['dependencies'].each { |k,v| s.add_dependency(k,v) }; + + s.post_install_message = "Installed Chef Cookbook #{s.name}\n#{s.description}" + +end diff --git a/files/default/java.seed b/files/default/java.seed new file mode 100644 index 0000000..bf44093 --- /dev/null +++ b/files/default/java.seed @@ -0,0 +1,11 @@ +sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true +sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true +sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true +sun-java6-jre sun-java6-jre/stopthread boolean true +sun-java6-jre sun-java6-jre/jcepolicy note +sun-java6-bin shared/error-sun-dlj-v1-1 error +sun-java6-jdk shared/error-sun-dlj-v1-1 error +sun-java6-jre shared/error-sun-dlj-v1-1 error +sun-java6-bin shared/present-sun-dlj-v1-1 note +sun-java6-jdk shared/present-sun-dlj-v1-1 note +sun-java6-jre shared/present-sun-dlj-v1-1 note \ No newline at end of file diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..3f3faff --- /dev/null +++ b/metadata.json @@ -0,0 +1,41 @@ +{ + "groupings": { + + }, + "recommendations": { + + }, + "platforms": { + + }, + "license": "Apache v2.0", + "maintainer": "37signals", + "suggestions": { + + }, + "maintainer_email": "sysadmins@37signals.com", + "version": "0.1.0", + "conflicting": { + + }, + "description": "Configures java", + "providing": { + "java": [ + + ] + }, + "name": "java", + "attributes": { + + }, + "long_description": "", + "recipes": { + "java": "" + }, + "replacing": { + + }, + "dependencies": { + + } +} \ No newline at end of file diff --git a/metadata.rb b/metadata.rb index c07261c..0bf7e10 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,16 +1,10 @@ maintainer "Opscode, Inc." maintainer_email "cookbooks@opscode.com" license "Apache 2.0" -description "Installs Java runtime." -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "1.4.0" +description "Installs java" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.10.0" -recipe "java", "Installs Java runtime" -recipe "java::openjdk", "Installs the OpenJDK flavor of Java" -recipe "java::oracle", "Installs the Oracle flavor of Java" -recipe "java::oracle_i386", "Installs the 32-bit jvm without setting it as the default" - - -%w{ debian ubuntu centos redhat scientific fedora amazon arch freebsd }.each do |os| +%w{ debian ubuntu redhat centos fedora }.each do |os| supports os end diff --git a/providers/ark.rb b/providers/ark.rb deleted file mode 100644 index f1c6c4e..0000000 --- a/providers/ark.rb +++ /dev/null @@ -1,158 +0,0 @@ -# -# Author:: Bryan W. Berry () -# Cookbook Name:: java -# Provider:: ark -# -# Copyright 2011, Bryan w. Berry -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -def parse_app_dir_name url - file_name = url.split('/')[-1] - # funky logic to parse oracle's non-standard naming convention - # for jdk1.6 - if file_name =~ /^(jre|jdk).*$/ - major_num = file_name.scan(/\d/)[0] - update_num = file_name.scan(/\d+/)[1] - # pad a single digit number with a zero - if update_num.length < 2 - update_num = "0" + update_num - end - package_name = file_name.scan(/[a-z]+/)[0] - app_dir_name = "#{package_name}1.#{major_num}.0_#{update_num}" - else - app_dir_name = file_name.split(/(.tar.gz|.zip)/)[0] - app_dir_name = app_dir_name.split("-bin")[0] - end - [app_dir_name, file_name] -end - -action :install do - app_dir_name, tarball_name = parse_app_dir_name(new_resource.url) - app_root = new_resource.app_home.split('/')[0..-2].join('/') - app_dir = app_root + '/' + app_dir_name - - unless new_resource.default - Chef::Log.debug("processing alternate jdk") - app_dir = app_dir + "_alt" - app_home = app_dir - else - app_home = new_resource.app_home - end - - unless ::File.exists?(app_dir) - Chef::Log.info "Adding #{new_resource.name} to #{app_dir}" - require 'fileutils' - - unless ::File.exists?(app_root) - FileUtils.mkdir app_root, :mode => new_resource.app_home_mode - FileUtils.chown new_resource.owner, new_resource.owner, app_root - end - - r = remote_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do - source new_resource.url - checksum new_resource.checksum - mode 0755 - action :nothing - end - r.run_action(:create_if_missing) - - require 'tmpdir' - - tmpdir = Dir.mktmpdir - case tarball_name - when /^.*\.bin/ - cmd = Chef::ShellOut.new( - %Q[ cd "#{tmpdir}"; - cp "#{Chef::Config[:file_cache_path]}/#{tarball_name}" . ; - bash ./#{tarball_name} -noregister - ] ).run_command - unless cmd.exitstatus == 0 - Chef::Application.fatal!("Failed to extract file #{tarball_name}!") - end - when /^.*\.zip/ - cmd = Chef::ShellOut.new( - %Q[ unzip "#{Chef::Config[:file_cache_path]}/#{tarball_name}" -d "#{tmpdir}" ] - ).run_command - unless cmd.exitstatus == 0 - Chef::Application.fatal!("Failed to extract file #{tarball_name}!") - end - when /^.*\.tar.gz/ - cmd = Chef::ShellOut.new( - %Q[ tar xvzf "#{Chef::Config[:file_cache_path]}/#{tarball_name}" -C "#{tmpdir}" ] - ).run_command - unless cmd.exitstatus == 0 - Chef::Application.fatal!("Failed to extract file #{tarball_name}!") - end - end - - cmd = Chef::ShellOut.new( - %Q[ mv "#{tmpdir}/#{app_dir_name}" "#{app_dir}" ] - ).run_command - unless cmd.exitstatus == 0 - Chef::Application.fatal!(%Q[ Command \' mv "#{tmpdir}/#{app_dir_name}" "#{app_dir}" \' failed ]) - end - FileUtils.rm_r tmpdir - new_resource.updated_by_last_action(true) - end - - #update-alternatives - if new_resource.default - Chef::Log.debug "app_home is #{app_home} and app_dir is #{app_dir}" - current_link = ::File.symlink?(app_home) ? ::File.readlink(app_home) : nil - if current_link != app_dir - Chef::Log.debug "symlinking #{app_dir} to #{app_home}" - FileUtils.rm_f app_home - FileUtils.ln_sf app_dir, app_home - end - if new_resource.bin_cmds - new_resource.bin_cmds.each do |cmd| - if ::File.exists? "/usr/bin/#{cmd}" - current_bin_link = ::File.readlink("/usr/bin/#{cmd}") - else - current_bin_link = false - end - should_be_link = "#{app_home}/bin/#{cmd}" - if current_bin_link != should_be_link - cmd = Chef::ShellOut.new( - %Q[ update-alternatives --install /usr/bin/#{cmd} #{cmd} #{app_home}/bin/#{cmd} 1; - update-alternatives --set #{cmd} #{app_home}/bin/#{cmd} ] - ).run_command - unless cmd.exitstatus == 0 - Chef::Application.fatal!(%Q[ update alternatives failed ]) - end - end - end - end - end -end - -action :remove do - app_dir_name, tarball_name = parse_app_dir_name(new_resource.url) - app_root = new_resource.app_home.split('/')[0..-2].join('/') - app_dir = app_root + '/' + app_dir_name - - if ::File.exists?(app_dir) - new_resource.bin_cmds.each do |cmd| - cmd = execute "update_alternatives" do - command "update-alternatives --remove #{cmd} #{app_dir} " - returns [0,2] - action :nothing - end - cmd.run_action(:run) - end - Chef::Log.info "Removing #{new_resource.name} at #{app_dir}" - FileUtils.rm_rf app_dir - new_resource.updated_by_last_action(true) - end -end diff --git a/recipes/default.rb b/recipes/default.rb index 5b41dae..66f5db0 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,9 +1,8 @@ # -# Author:: Seth Chisamore () # Cookbook Name:: java # Recipe:: default # -# Copyright 2008-2011, Opscode, Inc. +# Copyright 2008-2009, Opscode, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,4 +17,16 @@ # limitations under the License. # -include_recipe "java::#{node['java']['install_flavor']}" +java_pkg = value_for_platform( + [ "ubuntu", "debian" ] => { + "default" => "openjdk-6-jre-headless" + }, + [ "redhat", "centos", "fedora" ] => { + "default" => "java-1.6.0-openjdk" + }, + "default" => "openjdk-6-jre-headless" +) + +package java_pkg do + action :install +end diff --git a/recipes/openjdk.rb b/recipes/openjdk.rb deleted file mode 100644 index ff211bb..0000000 --- a/recipes/openjdk.rb +++ /dev/null @@ -1,83 +0,0 @@ -# Author:: Bryan W. Berry () -# Author:: Seth Chisamore () -# Cookbook Name:: java -# Recipe:: openjdk -# -# Copyright 2010-2011, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version = node['java']['jdk_version'] -java_home = node['java']['java_home'] -java_home_parent = File.dirname java_home -jdk_home = "" - -pkgs = value_for_platform( - ["centos","redhat","fedora"] => { - "default" => ["java-1.#{version}.0-openjdk","java-1.#{version}.0-openjdk-devel"] - }, - ["arch","freebsd"] => { - "default" => ["openjdk#{version}"] - }, - "default" => ["openjdk-#{version}-jdk"] - ) - -# done by special request for rberger -ruby_block "set-env-java-home" do - block do - ENV["JAVA_HOME"] = java_home - end -end - -if platform?("ubuntu","debian","redhat","centos","fedora","scientific","amazon") - ruby_block "update-java-alternatives" do - block do - if platform?("ubuntu", "debian") and version == 6 - run_context = Chef::RunContext.new(node, {}) - r = Chef::Resource::Execute.new("update-java-alternatives", run_context) - r.command "update-java-alternatives -s java-6-openjdk" - r.returns [0,2] - r.run_action(:create) - else - # have to do this on ubuntu for version 7 because Ubuntu does - # not currently set jdk 7 as the default jvm on installation - require "fileutils" - arch = node['kernel']['machine'] =~ /x86_64/ ? "x86_64" : "i386" - Chef::Log.debug("glob is #{java_home_parent}/java*#{version}*openjdk*") - jdk_home = Dir.glob("#{java_home_parent}/java*#{version}*openjdk{,[-\.]#{arch}}")[0] - Chef::Log.debug("jdk_home is #{jdk_home}") - # delete the symlink if it already exists - if File.exists? java_home - FileUtils.rm_f java_home - end - FileUtils.ln_sf jdk_home, java_home - - cmd = Chef::ShellOut.new( - %Q[ update-alternatives --install /usr/bin/java java #{java_home}/bin/java 1; - update-alternatives --set java #{java_home}/bin/java ] - ).run_command - unless cmd.exitstatus == 0 or cmd.exitstatus == 2 - Chef::Application.fatal!("Failed to update-alternatives for openjdk!") - end - end - end - action :nothing - end -end - -pkgs.each do |pkg| - package pkg do - action :install - notifies :create, "ruby_block[update-java-alternatives]" if platform?("ubuntu","debian","redhat","centos","fedora","scientific","amazon") - end -end diff --git a/recipes/oracle.rb b/recipes/oracle.rb deleted file mode 100644 index cf4426d..0000000 --- a/recipes/oracle.rb +++ /dev/null @@ -1,52 +0,0 @@ -# -# Author:: Bryan W. Berry () -# Cookbook Name:: java -# Recipe:: oracle -# -# Copyright 2011, Bryan w. Berry -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -java_home = node['java']["java_home"] -arch = node['java']['arch'] -jdk_version = node['java']['jdk_version'] - -#convert version number to a string if it isn't already -if jdk_version.instance_of? Fixnum - jdk_version = jdk_version.to_s -end - -case jdk_version -when "6" - tarball_url = node['java']['jdk']['6'][arch]['url'] - tarball_checksum = node['java']['jdk']['6'][arch]['checksum'] -when "7" - tarball_url = node['java']['jdk']['7'][arch]['url'] - tarball_checksum = node['java']['jdk']['7'][arch]['checksum'] -end - -ruby_block "set-env-java-home" do - block do - ENV["JAVA_HOME"] = java_home - end -end - -java_ark "jdk" do - url tarball_url - checksum tarball_checksum - app_home java_home - bin_cmds ["java"] - action :install -end - diff --git a/recipes/oracle_i386.rb b/recipes/oracle_i386.rb deleted file mode 100644 index 192766a..0000000 --- a/recipes/oracle_i386.rb +++ /dev/null @@ -1,48 +0,0 @@ -# -# Author:: Bryan W. Berry () -# Cookbook Name:: java -# Recipe:: oracle_i386 -# -# Copyright 2010-2011, Opscode, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -java_home = node['java']["java_home"] - -case node['java']['jdk_version'] -when "6" - tarball_url = node['java']['jdk']['6']['i586']['url'] - tarball_checksum = node['java']['jdk']['6']['i586']['checksum'] -when "7" - tarball_url = node['java']['jdk']['7']['i586']['url'] - tarball_checksum = node['java']['jdk']['7']['i586']['checksum'] -end - -ruby_block "set-env-java-home" do - block do - ENV["JAVA_HOME"] = java_home - end -end - -yum_package "glibc" do - arch "i686" -# provider Chef::Provider::Package::Yum -end - -java_ark "jdk-alt" do - url tarball_url - checksum tarball_checksum - app_home java_home - default false - action :install -end diff --git a/resources/ark.rb b/resources/ark.rb deleted file mode 100644 index 77c8e84..0000000 --- a/resources/ark.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Author:: Bryan W. Berry () -# Cookbook Name:: java -# Resource:: ark -# -# Copyright 2011, Bryan w. Berry -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -actions :install, :remove - -attribute :url, :regex => /^http:\/\/.*(tar.gz|bin|zip)$/, :default => nil -attribute :mirrorlist, :kind_of => Array, :default => nil -attribute :checksum, :regex => /^[a-zA-Z0-9]{64}$/, :default => nil -attribute :app_home, :kind_of => String, :default => nil -attribute :app_home_mode, :kind_of => Integer, :default => 0755 -attribute :bin_cmds, :kind_of => Array, :default => nil -attribute :owner, :default => "root" -attribute :default, :equal_to => [true, false], :default => true - -# we have to set default for the supports attribute -# in initializer since it is a 'reserved' attribute name -def initialize(*args) - super - @action = :install - @supports = {:report => true, :exception => true} -end