blob: 60f098b7c6118208165e417d27fe7867af6f0ef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require 'formula'
class Hadoop < Formula
homepage 'http://hadoop.apache.org/common/'
url 'http://www.apache.org/dyn/closer.cgi?path=hadoop/core/hadoop-1.0.4/hadoop-1.0.4.tar.gz'
sha1 '1ab6f3271289ff83ba7b44a090ec1a3e6b77d1dd'
def shim_script target
<<-EOS.undent
#!/bin/bash
exec "#{libexec}/bin/#{target}" "$@"
EOS
end
def install
rm_f Dir["bin/*.bat"]
libexec.install %w[bin conf lib webapps contrib]
libexec.install Dir['*.jar']
bin.mkpath
Dir["#{libexec}/bin/*"].each do |b|
n = Pathname.new(b).basename
(bin+n).write shim_script(n)
end
inreplace "#{libexec}/conf/hadoop-env.sh",
"# export JAVA_HOME=/usr/lib/j2sdk1.5-sun",
"export JAVA_HOME=\"$(/usr/libexec/java_home)\""
end
def caveats; <<-EOS.undent
In Hadoop's config file:
#{libexec}/conf/hadoop-env.sh
$JAVA_HOME has been set to be the output of:
/usr/libexec/java_home
EOS
end
end
|