From feb9ca401771941c864ca9aa382a15d1cecbda48 Mon Sep 17 00:00:00 2001 From: Peter Hoellig Date: Mon, 1 Jul 2013 17:36:37 -0500 Subject: [PATCH] Adds an attribute to allow java to be installed to other directories on Windows. The default install directory for java on windows platforms is C:\Program Files\Java. It is useful to be able to change this if whitespace in the install path can become a problem. --- README.md | 2 ++ attributes/default.rb | 1 + recipes/windows.rb | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed430541..2d8c5698 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ the .tar.gz. * `node['java']['windows']['package_name']` - The package name used by windows_package to check in the registry to determine if the install has already been run +* `node['java']['windows']['install_dir']` - The directory in which java + should be installed on windows. Defaults to C:/Java. * `node['java']['ibm']['url']` - The URL which to download the IBM JDK/SDK. See the `ibm` recipe section below. * `node['java']['ibm']['accept_ibm_download_terms']` - Indicates that diff --git a/attributes/default.rb b/attributes/default.rb index 5e946874..264164c8 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -40,6 +40,7 @@ default['java']['install_flavor'] = "windows" default['java']['windows']['url'] = nil default['java']['windows']['package_name'] = "Java(TM) SE Development Kit 7 (64-bit)" + default['java']['windows']['install_dir'] = "C:/Java" when "debian" default['java']['java_home'] = "/usr/lib/jvm/default-java" default['java']['openjdk_packages'] = ["openjdk-#{node['java']['jdk_version']}-jdk", "default-jre-headless"] diff --git a/recipes/windows.rb b/recipes/windows.rb index 8480edc4..4d7d3d7d 100644 --- a/recipes/windows.rb +++ b/recipes/windows.rb @@ -20,9 +20,11 @@ Chef::Log.warn("No download url set for java installer.") unless node['java']['windows']['url'] +install_args = '/s INSTALLDIR="' + node['java']['windows']['install_dir'] + '"' + windows_package node['java']['windows']['package_name'] do source node['java']['windows']['url'] action :install installer_type :custom - options "/s" -end \ No newline at end of file + options install_args +end