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 #!/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 Label #{plist_name} Program #{opt_bin}/packetbeat RunAtLoad EOS end test do system "#{bin}/packetbeat", "--devices" end end