homebrew-core/Formula/packetbeat.rb
2017-10-10 11:22:55 -07:00

63 lines
1.9 KiB
Ruby

class Packetbeat < Formula
desc "Lightweight Shipper for Network Data"
homepage "https://www.elastic.co/products/beats/packetbeat"
url "https://github.com/elastic/beats/archive/v5.6.3.tar.gz"
sha256 "52a4c9094287f725a089e161dc71d9cdf0caf73595e8835a5d0636d3ad333bbe"
head "https://github.com/elastic/beats.git"
bottle do
cellar :any_skip_relocation
sha256 "1f066f8da82ae074482619439f5ecdc98b40e24113762221ed3bf973292bc5c2" => :high_sierra
sha256 "41737f9e395f9dc5507ae63d70b5d0ad26bb5e61622ec3b0afc0d6d79dbdc26d" => :sierra
sha256 "9e64cce39952f8083470efe7957ae9fd9d35cf6a9c665c95c97bd1501a3eb714" => :el_capitan
end
depends_on "go" => :build
def install
gopath = buildpath/"gopath"
(gopath/"src/github.com/elastic/beats").install Dir["{*,.git,.gitignore}"]
ENV["GOPATH"] = gopath
cd gopath/"src/github.com/elastic/beats/packetbeat" do
system "make"
libexec.install "packetbeat"
inreplace "packetbeat.yml", "packetbeat.interfaces.device: any", "packetbeat.interfaces.device: en0"
(etc/"packetbeat").install("packetbeat.yml", "packetbeat.template.json", "packetbeat.template-es2x.json")
end
(bin/"packetbeat").write <<-EOS.undent
#!/bin/sh
exec #{libexec}/packetbeat -path.config #{etc}/packetbeat \
-path.home #{prefix} -path.logs #{var}/log/packetbeat \
-path.data #{var}/packetbeat $@
EOS
end
plist_options :manual => "packetbeat"
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
<string>#{opt_bin}/packetbeat</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
system "#{bin}/packetbeat", "--devices"
end
end