On 11/20/2012 01:05 PM, Arnau Bria wrote:
Hi all,
In my systems (SL 6.3, RH like) I'm installing Oracle's Java.
I'm managing the package and several links under /etc/alternatives
with puppet, but for configuring it, all the 'official' docs recommends
'alternatives'. I've been looking for some module which already
deals with it, but I've not found any... anyone knows any module with
deals with alternatives?
TIA,
Arnau
Hi,
I' ve attached my java module.
We needed to install multiple java versions on the same hosts, so, i
repackaged them to make that possible. That's why i use the alternatives
to set a default system wide java version. I also added a spec file as
example.
This version is made to run on sles11spX. I'm now making the deb
packages for the custom java version.
I hope this will put you on the right track for a possible solution.
Any comments are welcome.
Grts
johan
--
Johan De Wit
Open Source Consultant
Red Hat Certified Engineer (805008667232363)
Puppet Certified Professional 2013 (PCP0000006)
_________________________________________________________
Open-Future Phone +32 (0)2/255 70 70
Zavelstraat 72 Fax +32 (0)2/255 70 71
3071 KORTENBERG Mobile +32 (0)474/42 40 73
BELGIUM http://www.open-future.be
_________________________________________________________
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
class java {
}
# Define: install_java
#
# This definition installs the vrt repacked java versions.
# Multiple versions can now be installed together on the
# the same host. Also the 64bit and 32bit can coexist on the
# same host
#
# [version]
# Which java version to install
# Possible values : 6 or 7
# Default : 6
#
# [arch]
# Which version to install, 64 or 32 bit
# Possible values : x64, the rest installs the 32bit version
# Default : x64
#
# [jdk]
# Wether to install the jdk or the jre
# Possible values : True, False, Yes, No, Y, N, 0, 1
# Default :False
#
# [register]
# Wether to register the jdk or the jre, so the installed version
# can be used as /usr/bin/java
# Possible values : True, False, Yes, No, Y, N, 0, 1
# Default : true
#
# [prio]
# Piority of the java version. The java version with the highest prio
# will be linked to /usr/bin/java
#
define java::install_java ( version ='6', arch='x64', jdk=false, register=true,
prio='1' ) {
# check version,
case $version {
'6': {
$my_version = '1.6.0_33'
}
'7': {
$my_version = '1.7.0_05'
}
default: {
notify { 'unsupported java version selected - only
6u33, 7u5 are supported': }
}
}
case $arch {
'x64': {
$my_arch = ''
$my_parch = 'x86_64'
}
default: {
$my_arch = '-32bit'
$my_parch = 'i586'
}
}
case $jdk {
true,'yes','1','Y','y': {
$my_jdk = 'jdk'
}
default: {
$my_jdk = 'jre'
}
}
package { "unixODBC${my_arch}":
ensure => present,
}
package { "${my_jdk}${my_arch}-${my_version}-repack":
ensure => present,
require => Package[ "unixODBC${my_arch}" ]
}
case $register {
true,'yes','1','Y','y': {
java::register_java {
"${my_jdk}${my_arch}-${my_version}-repack":
order => $prio,
path =>
"/opt/java/${my_parch}/${my_jdk}${my_version}/",
require => Package[
"${my_jdk}${my_arch}-${my_version}-repack" ],
}
}
}
}
define java::register_java ( order='1' , path ) {
$my_prio = $order * 20000
$reg_command = "/usr/sbin/update-alternatives --install \
/usr/bin/java java ${path}/bin/java $my_prio \
--slave /usr/bin/keytool keytool $path/bin/keytool \
--slave /usr/bin/orbd orbd ${path}/bin/orbd \
--slave /usr/bin/pack200 pack200 ${path}/bin/pack200 \
--slave /usr/bin/policytool policytool
${path}/bin/policytool \
--slave /usr/bin/rmid rmid ${path}/bin/rmid \
--slave /usr/bin/rmiregistry rmiregistry
${path}/bin/rmiregistry \
--slave /usr/bin/tnameserv tnameserv
${path}/bin/tnameserv \
--slave /usr/bin/unpack200 unpack200
${path}/bin/unpack200"
exec { 'do_reg_java':
command => $reg_command,
unless => "/usr/sbin/update-alternatives --display java | grep
${path}",
notify => Exec[ 'activate_java'],
}
exec { 'activate_java':
command => '/usr/sbin/update-alternatives --auto java',
refreshonly => true,
}
}
# spec file for jre/jdk repackaging of the oracle java packages.
#
Name: jdk
License: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Also under other license(s) as shown at the Description field.
Version: 1.6.0_33
Release: repack
Vendor: Oracle and/or its affiliates.
Source0: jdk-6u33-linux-i586.bin
Source1: jdk-6u33-linux-x64.bin
Prefix: /opt/java
Group: Development/Tools
Url: http://www.oracle.com/technetwork/java/javase/overview/index.html
Summary: Java(TM) Platform Standard Edition Development Kit
Packager: Johan De Wit <johan.de...@vrt.be>
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%package 32bit
Summary: Java(TM) Platform Standard Edition Development Kit 32bit version VRT repackaged
Group: Development/Tools
%description
The Java Platform Standard Edition Development Kit (JDK) includes both
the runtime environment (Java virtual machine, the Java platform classes
and supporting files) and development tools (compilers, debuggers,
tool libraries and other tools).
The JDK is a development environment for building applications, applets
and components that can be deployed with the Java Platform Standard
Edition Runtime Environment.
This is the VRT repackaged version
%description 32bit
The Java Platform Standard Edition Development Kit (JDK) includes both
the runtime environment (Java virtual machine, the Java platform classes
and supporting files) and development tools (compilers, debuggers,
tool libraries and other tools).
The JDK is a development environment for building applications, applets
and components that can be deployed with the Java Platform Standard
Edition Runtime Environment.
This is the VRT 32bit repackaged version
%prep
%build
%install
cd %buildroot
mkdir -p %{buildroot}%{prefix}/{i586,x86_64}
cd %{buildroot}%{prefix}/i586
chmod 755 %{SOURCE0}
%{SOURCE0}
cd %{buildroot}%{prefix}/x86_64
chmod 755 %{SOURCE1}
%{SOURCE1}
%files 32bit
%{prefix}/i586/%{name}%{version}/
%files
%{prefix}/x86_64/%{name}%{version}/
%changelog
* Tue Mar 27 2012 Johan De Wit <johan.de...@vrt.be>
- repackaging to be able to install multiple java versions
# spec file for jre/jdk repackaging of the oracle java packages.
#
Name: jre
License: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Also under other license(s) as shown at the Description field.
Version: 1.6.0_33
Release: repack
Vendor: Oracle and/or its affiliates.
Source0: jre-6u33-linux-i586.bin
Source1: jre-6u33-linux-x64.bin
Prefix: /opt/java
Group: Development/Tools
Url: http://www.oracle.com/technetwork/java/javase/overview/index.html
Summary: Java(TM) Platform Standard Edition Runtime Environment
Packager: Johan De Wit <johan.de...@vrt.be>
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%package 32bit
Summary: Java(TM) Platform Standard Edition Runtime Environment 32bit version VRT repackaged
Group: Development/Tools
%description
The Java Platform Standard Edition Runtime Environment (JRE) contains
everything necessary to run applets and applications designed for the
Java platform. This includes the Java virtual machine, plus the Java
platform classes and supporting files.
The JRE is freely redistributable, per the terms of the included license.
This is the VRT repackaged version
%description 32bit
The Java Platform Standard Edition Runtime Environment (JRE) contains
everything necessary to run applets and applications designed for the
Java platform. This includes the Java virtual machine, plus the Java
platform classes and supporting files.
The JRE is freely redistributable, per the terms of the included license.
This is the VRT 32bit repackaged version
%prep
%build
%install
cd %buildroot
mkdir -p %{buildroot}%{prefix}/{i586,x86_64}
cd %{buildroot}%{prefix}/i586
chmod 755 %{SOURCE0}
%{SOURCE0}
cd %{buildroot}%{prefix}/x86_64
chmod 755 %{SOURCE1}
%{SOURCE1}
%files 32bit
%{prefix}/i586/%{name}%{version}/
%files
%{prefix}/x86_64/%{name}%{version}/
%changelog
* Tue Mar 27 2012 Johan De Wit <johan.de...@vrt.be>
- repackaging to be able to install multiple java versions