homebrew-core/Formula/packetbeat.rb
2017-09-18 23:26:46 +02: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.1.tar.gz"
sha256 "3534ef7a3833ae85aef53a12580520b5d85feaa1408289ea37a6ebff5a2fda0a"
head "https://github.com/elastic/beats.git"
bottle do
cellar :any_skip_relocation
sha256 "9165e51a5425b6c146cc3180884c210c87756964290e076f55f07954a74680b0" => :high_sierra
sha256 "8f15d0bfa8c863a4afe667b9039006457c89b951cee7cd4ee2f5c9ce94a02b86" => :sierra
sha256 "11b7e174fe377aa4092216e9d9947e7b70dde472157ac16e5e8174ae0c50f619" => :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