homebrew-core/Formula/packetbeat.rb
2017-09-27 06:51:44 -07:00

64 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.2.tar.gz"
sha256 "72e247d6ec3586883cd58bc6465d18b7eb0857763ff422259205abf090557e45"
head "https://github.com/elastic/beats.git"
bottle do
cellar :any_skip_relocation
rebuild 1
sha256 "ac0bb249446b1b283855886db2dea7171ca03cc4c0922bb01c0632d8545d6843" => :high_sierra
sha256 "e897bb2b82a8666eacf7c3c1245c5506b98fbdbd0a1ec026b8499273c42654bb" => :sierra
sha256 "5147d16457ff751c073c5064a03cef73914503768a5baac52a01fb6d4d8ab3e2" => :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