2009-12-18 20:07:06 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Hadoop < Formula
|
2011-07-27 09:41:17 +00:00
|
|
|
url 'http://www.apache.org/dyn/closer.cgi?path=hadoop/core/hadoop-0.21.0/hadoop-0.21.0.tar.gz'
|
2009-12-18 20:07:06 +00:00
|
|
|
homepage 'http://hadoop.apache.org/common/'
|
2011-03-13 17:10:09 +00:00
|
|
|
md5 'ec0f791f866f82a7f2c1319a54f4db97'
|
2009-12-18 20:07:06 +00:00
|
|
|
|
2010-05-05 15:48:41 +00:00
|
|
|
def shim_script target
|
|
|
|
<<-EOS.undent
|
2010-04-07 05:58:35 +00:00
|
|
|
#!/bin/bash
|
2011-03-13 17:10:09 +00:00
|
|
|
exec #{libexec}/bin/#{target} $@
|
2010-05-05 15:48:41 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2009-12-18 20:07:06 +00:00
|
|
|
def install
|
2010-03-06 07:27:21 +00:00
|
|
|
rm_f Dir["bin/*.bat"]
|
2011-06-14 06:21:06 +00:00
|
|
|
libexec.install %w[bin conf lib webapps mapred]
|
2010-07-24 21:42:41 +00:00
|
|
|
libexec.install Dir['*.jar']
|
2010-05-05 15:48:41 +00:00
|
|
|
bin.mkpath
|
|
|
|
Dir["#{libexec}/bin/*"].each do |b|
|
|
|
|
n = Pathname.new(b).basename
|
|
|
|
(bin+n).write shim_script(n)
|
|
|
|
end
|
2011-03-13 17:10:09 +00:00
|
|
|
|
|
|
|
inreplace "#{libexec}/conf/hadoop-env.sh",
|
|
|
|
"# export JAVA_HOME=/usr/lib/j2sdk1.6-sun",
|
|
|
|
"export JAVA_HOME=$(/usr/libexec/java_home)"
|
2010-05-05 15:48:41 +00:00
|
|
|
end
|
|
|
|
|
2011-03-13 17:10:09 +00:00
|
|
|
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
|
2010-05-05 15:48:41 +00:00
|
|
|
EOS
|
2009-12-18 20:07:06 +00:00
|
|
|
end
|
|
|
|
end
|