Installing Java

6 views
Skip to first unread message

Paul Canavese

unread,
Nov 6, 2009, 11:36:27 PM11/6/09
to rubber
Has anyone succeeded in scripting Java installation with it's
interactive license prompts?

Thanks,

Paul

Matthew Conway

unread,
Nov 7, 2009, 12:04:43 AM11/7/09
to rubbe...@googlegroups.com

On Nov 6, 2009, at Fri Nov 6, 11:36 PM, Paul Canavese wrote:

>
> Has anyone succeeded in scripting Java installation with it's
> interactive license prompts?

I did it once when I was using solr, looked something like the below
for Sun's jre, and then add the java package like any other. I think
you can also install the openjdk (package name openjdk-6-jdk) instead
which doesn't need the hack below.

before "rubber:install_packages", "rubber:base:install_java"
task :install_java, :roles => :search do
# Hack to accept the jre license prior to installing it
jre_license_accept = <<-DATA
Name: shared/accepted-sun-dlj-v1-1
Template: shared/accepted-sun-dlj-v1-1
Value: true
Owners:
Flags: seen
DATA
jre_license_accept.gsub!(/^ */, '')
put(jre_license_accept, "/tmp/jre_license_accept")

debconf="/var/cache/debconf/config.dat"
rubber.sudo_script 'install_java', <<-ENDSCRIPT
if ! grep "^Name: shared/accepted-sun-dlj-v1-1" #{debconf}
&> /dev/null; then
cat /tmp/jre_license_accept >> #{debconf}
fi
ENDSCRIPT
end

Matt

Paul Canavese

unread,
Nov 7, 2009, 2:03:41 PM11/7/09
to rubber
> I did it once when I was using solr, looked something like the below for Sun's jre...

Yep, I came across a similar approach before I got your response. It
turns out it can be accomplished a little more simply. I'm now doing
the following:

before "rubber:install_packages", "rubber:base:pre_install_java"
task :pre_install_java do
sudo "echo 'sun-java5-jdk shared/accepted-sun-dlj-v1-1 select
true' | /usr/bin/debconf-set-selections"
sudo "echo 'sun-java5-jre shared/accepted-sun-dlj-v1-1 select
true' | /usr/bin/debconf-set-selections"
sudo "echo 'sun-java6-jdk shared/accepted-sun-dlj-v1-1 select
true' | /usr/bin/debconf-set-selections"
sudo "echo 'sun-java6-jre shared/accepted-sun-dlj-v1-1 select
true' | /usr/bin/debconf-set-selections"
end

Thanks,

Paul
Reply all
Reply to author
Forward
0 new messages