diff --git a/.gitignore b/.gitignore index ff65af8..7a9c876 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,3 @@ bin/* #IDE .idea -.kitchen/ -.kitchen.local.yml diff --git a/.kitchen.yml b/.kitchen.yml deleted file mode 100644 index a4b9f81..0000000 --- a/.kitchen.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -driver: - name: vagrant - -provisioner: - name: chef_zero - -platforms: - - name: macosx-10.10 - driver: - provider: vmware_fusion - box: macosx-10.10 - box_url: http://YOUR_SERVER_HERE/macosx-10.10.vmware.box - -suites: - - name: default - run_list: - - recipe[java-mac::default] diff --git a/Berksfile b/Berksfile index 967b9a7..9c755d0 100644 --- a/Berksfile +++ b/Berksfile @@ -1,3 +1,5 @@ -source "https://supermarket.chef.io" +site :opscode metadata + +cookbook 'dmg', git: 'https://github.com/Sauraus/dmg.git', branch: 'pending' diff --git a/CHANGELOG.md b/CHANGELOG.md index eb55162..4504b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,5 @@ # java-mac Cookbook Change Log -##1.1.2 -* Remove dmg cookbook version constraint -* Added kitchen test to install java - -##1.1.1 -* Remove line cookbook version constraint - -##1.1.0 -* Move cookie to node attribute -* Update supermarket source -* Add missing dependency on line cookbook -* Fix for adding java_home to profile (revert 1.0.2) - -##1.0.3 -* updated JAVA (JDK and JRE) version to 7u80 - ##1.0.2 * Command to set JAVA_HOME in /etc/profile diff --git a/Gemfile b/Gemfile index 6f3cade..3017623 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,3 @@ source 'https://rubygems.org' gem 'berkshelf' -gem "test-kitchen" -gem "kitchen-vagrant" diff --git a/README.md b/README.md index 2d2722b..12f0456 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,25 @@ java-mac =========== -OSX JAVA cookbook +Mac OS X JAVA cookbook Requirements ============ Chef 11 +NOTE +=========== + +The cookbook currently depends on a dmg cookbook by Sauraus that is ahead of the official Chef dmg cookbook. + Authors ================== -- Author:: Antek S. Baranski +- Author:: Antek Baranski ```text -Copyright 2015 Antek Baranski +Copyright 2014 Antek Baranski Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Thorfile b/Thorfile index 7a0c0ff..cb1aeae 100644 --- a/Thorfile +++ b/Thorfile @@ -3,10 +3,3 @@ require 'bundler' require 'bundler/setup' require 'berkshelf/thor' - -begin - require "kitchen/thor_tasks" - Kitchen::ThorTasks.new -rescue LoadError - puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"] -end diff --git a/attributes/default.rb b/attributes/default.rb index 30422fb..6d423c8 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,4 +20,3 @@ # default['java-mac']['type'] = 'JDK' -default['java-mac']['cookie'] = {'Cookie' => 'oraclelicense=accept-securebackup-cookie'} diff --git a/chefignore b/chefignore deleted file mode 100644 index 7be3c6d..0000000 --- a/chefignore +++ /dev/null @@ -1 +0,0 @@ -.kitchen diff --git a/metadata.rb b/metadata.rb index 7bf263d..21579fb 100644 --- a/metadata.rb +++ b/metadata.rb @@ -2,11 +2,10 @@ maintainer 'Antek Baranski' maintainer_email 'antek.baranski@gmail.com' license 'Apache 2.0' -description 'Installs and configures JAVA SDK or JRE on OSX' +description 'Installs and configures JAVA SDK on Mac OS X' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.1' +version '1.0.2' -recipe 'java-mac', 'Installs the JAVA SDK or JRE on OSX' +recipe 'java-mac', 'Installs the JAVA SDK or JRE on Mac OS X' depends 'dmg' -depends 'line' diff --git a/recipes/default.rb b/recipes/default.rb index 15e23a7..cb0159e 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -19,33 +19,38 @@ # limitations under the License. # +header = {'Cookie' => 'oraclelicense=accept-securebackup-cookie'} + case node['java-mac']['type'] when 'JRE' - dmg_package 'jre-8u66-macosx-x64' do - app 'Java 8 Update 66' + dmg_package 'jre-7u60-macosx-x64' do + app 'Java 7 Update 60' type 'pkg' - source 'http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jre-8u66-macosx-x64.dmg' - checksum '07b7c4547b03f5e296bd046ce5677e5b5ee967cc7fe5aebdd04f49c52d27b0b2' - headers node['java-mac']['cookie'] + source 'http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jre-7u60-macosx-x64.dmg' + checksum '526042a4eba12a7eb3f04237361b2300' + headers header accept_eula true - action :install + action :install end when 'JDK' - dmg_package 'jdk-8u66-macosx-x64' do - app 'JDK 8 Update 66' + dmg_package 'jdk-7u60-macosx-x64' do + app 'JDK 7 Update 60' type 'pkg' - source 'http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-macosx-x64.dmg' - checksum 'cd416de4f41f9f0a6984c456481437681674a717da62259740c54732f174fa08' - headers node['java-mac']['cookie'] + source 'http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-macosx-x64.dmg' + checksum '2ec232fcec17c3c3fdffa09350e4aac7' + headers header accept_eula true - action :install + action :install end else raise Chef::Exceptions::AttributeNotFound, - ("The java-mac cookbook only supports JRE or JDK as the installation types") + ("The JAVA Mac OS X cookbook only supports JRE or JDK as the installation types") end -append_if_no_line "Adding JAVA_HOME to /etc/profile" do - path "/etc/profile" - line "export JAVA_HOME=$(/usr/libexec/java_home)" +# Set JAVA_HOME +bash "Set JAVA_HOME" do + user "root" + code <<-EOH +JAVA_HOME=$(/usr/libexec/java_home); (grep -q '^export JAVA_HOME' /etc/profile && sed -i '' 's#^export JAVA_HOME=.*#export JAVA_HOME='"$JAVA_HOME"'#' /etc/profile) || echo '\nexport JAVA_HOME='$JAVA_HOME >> /etc/profile + EOH end