Permalink
Browse files

Merge pull request #21 from hardyoyo/DS-2014-Set-up-Java7-reliably

DS-2014 set up java7 reliably
  • Loading branch information...
2 parents a1e8dee + 34d427d commit f2f85d3711d765a14a4e42f5fb3bc216e8007c27 Hardy Pottinger committed May 28, 2014
Showing with 26 additions and 4 deletions.
  1. +3 −0 Vagrantfile
  2. +23 −4 modules/dspace/manifests/init.pp
View
@@ -200,6 +200,9 @@ Vagrant.configure("2") do |config|
# Use VBoxManage to provide Virtual Machine with extra memory (default is only 300MB)
vb.customize ["modifyvm", :id, "--memory", vb_memory]
+ # Use VBoxManage to have the Virtual Machine use the Host's DNS resolver
+ vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
+
# Use VBoxManage to ensure Virtual Machine only has access to 50% of host CPU
#vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
@@ -19,17 +19,36 @@
ensure => installed,
}
+ # Java installation directory
+ $install_dir = "/usr/lib/jvm"
+
+ # OpenJDK directory name (NOTE: $architecture is a "fact")
+ $dir_name = "java-1.${java_version}.0-openjdk-${architecture}"
+
# Install Java, based on set $java_version (passed to Puppet in VagrantFile)
package { "java":
name => "openjdk-${java_version}-jdk", # Install OpenJDK package (as Oracle JDK tends to require a more complex manual download & unzip)
}
- # Set Java defaults to point at our Java package
+ # Install the IcedTea plugin, as its absence seems to cause update-java-alternatives to fail
+ package { "icedtea-${java_version}-plugin":
+ name => "icedtea-${java_version}-plugin"
+ }
+
+ # Set Java defaults to point at OpenJDK
# NOTE: $architecture is a "fact" automatically set by Puppet's 'facter'.
- exec { "Update alternatives to Java ${jdk_version}":
+ exec { "Update alternatives to OpenJDK Java ${java_version}":
command => "update-java-alternatives --set java-1.${java_version}.0-openjdk-${architecture}",
- unless => "test \$(readlink /etc/alternatives/java) = '/usr/lib/jvm/java-${java_version}-openjdk-${architecture}/jre/bin/java'",
- require => [Package["java"], Package["maven"]], # Run *after* Maven is installed, since Maven install sometimes changes the java alternative!
+ unless => "test \$(readlink /etc/alternatives/java) = '${install_dir}/${dir_name}/jre/bin/java'",
+ path => "/usr/bin:/usr/sbin:/bin",
+ }
+
+ ->
+ # Create a "default-java" symlink (for easier JAVA_HOME setting). Overwrite if existing.
+ exec { "Symlink OpenJDK to '${install_dir}/default-java'":
+ cwd => $install_dir,
+ command => "ln -sfn ${dir_name} default-java",
+ unless => "test \$(readlink ${install_dir}/default-java) = '${dir_name}'",
path => "/usr/bin:/usr/sbin:/bin",
}

0 comments on commit f2f85d3

Please sign in to comment.