Created
June 30, 2014 14:17
-
-
Save RJ/94c8b37908c331093fcc to your computer and use it in GitHub Desktop.
java-bleh.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node.default['java']['install_flavor'] = 'oracle' # ugh | |
node.default['java']['jdk_version'] = '7' | |
node.default['java']['accept_license_agreement'] = true | |
node.default['java']['oracle']['accept_oracle_download_terms'] = true | |
## Mission: install oracle's java, because cassandra prefers it. | |
## | |
## Problem: esl-erlang depends on "default-jre-headless" (openjdk) | |
## but that conflicts with oracle's java packages, so we can't | |
## just remove openjdk, as it takes esl-erlang with it. | |
## | |
## "Solution": | |
## | |
## 1) remove all the openjdk packages without removing breaking-deps | |
## (this leaves esl-erlang installed, but with unsatisfied deps on java) | |
## | |
## 2) create and install a dummy package called "default-jre-headless" | |
## (this satisfies apt dependencies of esl-erlang, apt is happy) | |
## | |
## 3) install the oracle java packages | |
## since they provide the same jvm stuff as openjdk, no one notices. | |
## | |
## Note that ESL's more recent erlang packages for R16 onwards are split in | |
## the debian style, into lots of small packages. Once we upgrade to R16+ we | |
## can just install the erlang packages we need, ie the ones without a java dep | |
## | |
package "equivs" | |
script "remove openjdk gubbins (but leave deps alone)" do | |
interpreter "bash" | |
not_if "test -f /tmp/.java_hack_applied" | |
code <<-EOF | |
dpkg -r --force-depends \ | |
icedtea-6-jre-cacao \ | |
icedtea-6-jre-jamvm \ | |
openjdk-6-jre-lib \ | |
default-jre-headless \ | |
openjdk-6-jre-headless \ | |
ca-certificates-java | |
EOF | |
user "root" | |
end | |
p = "default-jre-headless" | |
script "install_fake_default-jre-headless" do | |
not_if "test -f /tmp/.java_hack_applied" | |
not_if "dpkg -s #{p}" | |
interpreter "bash" | |
code <<-EOF | |
cd /tmp | |
echo "Section: interpreters | |
Priority: optional | |
Standards-Version: 3.6.2 | |
Package: #{p} | |
Version: 1:99 | |
Maintainer: RJ <rj@metabrew.com> | |
Provides: #{p} | |
Description: fake #{p} package | |
to pretend #{p} is installed for apts sake (we use oracle pkgs)" > #{p} | |
equivs-build #{p} | |
dpkg -i ./#{p}*.deb | |
rm ./#{p}*.deb | |
echo "devops happened here.." > /tmp/.java_hack_applied | |
EOF | |
end | |
include_recipe "java" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks - used it to derive a sh script for my needs to solve a similar problem.