83 lines
2.7 KiB
Ruby
83 lines
2.7 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/v6.2.3.tar.gz"
|
|
sha256 "4ab58a55e61bd3ad31a597e5b02602b52d306d8ee1e4d4d8ff7662e2b554130e"
|
|
head "https://github.com/elastic/beats.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "042c0dd68f2df117e1b14eda1de365479cbdf6bb9da0e6424200bfdad424cbef" => :high_sierra
|
|
sha256 "87cda8e0f05a15b85ec01006a23b3f32a366780f7782acd5096dfd63e072f2ab" => :sierra
|
|
sha256 "7eabad62f6f4c348663a4a13ec184e59a45a2e5e54c83c342044ff6ead244a49" => :el_capitan
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "python@2" => :build
|
|
|
|
resource "virtualenv" do
|
|
url "https://files.pythonhosted.org/packages/b1/72/2d70c5a1de409ceb3a27ff2ec007ecdd5cc52239e7c74990e32af57affe9/virtualenv-15.2.0.tar.gz"
|
|
sha256 "1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
(buildpath/"src/github.com/elastic/beats").install buildpath.children
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", buildpath/"vendor/lib/python2.7/site-packages"
|
|
|
|
resource("virtualenv").stage do
|
|
system "python", *Language::Python.setup_install_args(buildpath/"vendor")
|
|
end
|
|
|
|
ENV.prepend_path "PATH", buildpath/"vendor/bin"
|
|
|
|
cd "src/github.com/elastic/beats/packetbeat" do
|
|
system "make"
|
|
# prevent downloading binary wheels during python setup
|
|
system "make", "PIP_INSTALL_COMMANDS=--no-binary :all", "python-env"
|
|
system "make", "DEV_OS=darwin", "update"
|
|
|
|
inreplace "packetbeat.yml", "packetbeat.interfaces.device: any", "packetbeat.interfaces.device: en0"
|
|
|
|
(etc/"packetbeat").install Dir["packetbeat.*", "fields.yml"]
|
|
(libexec/"bin").install "packetbeat"
|
|
prefix.install "_meta/kibana"
|
|
end
|
|
|
|
prefix.install_metafiles buildpath/"src/github.com/elastic/beats"
|
|
|
|
(bin/"packetbeat").write <<~EOS
|
|
#!/bin/sh
|
|
exec #{libexec}/bin/packetbeat \
|
|
--path.config #{etc}/packetbeat \
|
|
--path.data #{var}/lib/packetbeat \
|
|
--path.home #{prefix} \
|
|
--path.logs #{var}/log/packetbeat \
|
|
"$@"
|
|
EOS
|
|
end
|
|
|
|
plist_options :manual => "packetbeat"
|
|
|
|
def plist; <<~EOS
|
|
<?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
|