Permalink
Browse files

update java

  • Loading branch information...
1 parent 3b4f08a commit c90e9df432f67d93ee6add8f9ec3b8eced661aa0 @obazoud committed Apr 29, 2012
@@ -1,3 +1,8 @@
+## v1.5.0:
+
+* [COOK-1146] - Oracle now prevents download of JDK via non-browser
+* [COOK-1114] - fix File.exists?
+
## v1.4.2:
* [COOK-1051] - fix attributes typo and platform case switch
@@ -10,6 +10,31 @@ 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.
+**IMPORTANT NOTE** As of 26 March 2012 you can no longer directly download
+the JDK from Oracle's website without using a full-fledged browser.
+For that reason, the java::oracle recipe forces you to set up a
+private repository accessible by HTTP. It is best to override the
+dummy URL using a role.
+
+Example
+
+roles/base.rb
+
+ normal_attributes(
+ :java => {
+ :jdk => {
+ "6" => {
+ :x86_64 => {
+ :url => "http://hqlprrepo01.hq.un.fao.org/corporate/jdk-6u30-linux-x64.bin"
+ }
+ }
+ }
+ }
+ )
+
+You are most encouraged to voice your complaints to Oracle and/or
+switch to OpenJDK.
+
Requirements
============
@@ -35,18 +35,18 @@
# 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']['url'] = 'http://download.example.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']['url'] = 'http://download.example.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']['url'] = 'http://download.example.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']['url'] = 'http://download.example.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz'
default['java']['jdk']['7']['i586']['checksum'] = '74faad48fef2c368276dbd1fd6c02520b0e9ebdcb1621916c1af345fc3ba65d1'
@@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs Java runtime."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "1.4.2"
+version "1.5.1"
recipe "java", "Installs Java runtime"
recipe "java::openjdk", "Installs the OpenJDK flavor of Java"
@@ -19,7 +19,7 @@
version = node['java']['jdk_version']
java_home = node['java']['java_home']
-java_home_parent = File.dirname java_home
+java_home_parent = ::File.dirname java_home
jdk_home = ""
pkgs = value_for_platform(
@@ -57,7 +57,7 @@
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
+ if ::File.exists? java_home
FileUtils.rm_f java_home
end
FileUtils.ln_sf jdk_home, java_home
@@ -36,12 +36,24 @@
tarball_checksum = node['java']['jdk']['7'][arch]['checksum']
end
+if tarball_url =~ /example.com/
+ Chef::Application.fatal!("You must change the download link to your private repository. You can no longer download java directly from http://download.oracle.com without a web broswer")
+end
+
ruby_block "set-env-java-home" do
block do
ENV["JAVA_HOME"] = java_home
end
end
+file "/etc/profile.d/jdk.sh" do
+ content <<-EOS
+ export JAVA_HOME=#{node['java']["java_home"]}
+ EOS
+ mode 0755
+end
+
+
java_ark "jdk" do
url tarball_url
checksum tarball_checksum

0 comments on commit c90e9df

Please sign in to comment.