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.4.0.tar.gz" sha256 "d236f9433d48b69cc2f0bf3617f17d5f2eec261acee96cc28d8b72be84afc0a7" head "https://github.com/elastic/beats.git" bottle do cellar :any_skip_relocation sha256 "377e8d4d0d2a730678832c737b07e67e6e6d3642b6ee8721980f7c55da4c66ba" => :sierra sha256 "4a8ca3f2711347d6d457851d6fc626431bdc0e90e1280d6f3764005a23a3c8da" => :el_capitan sha256 "5eb66f54a333b1be8e70498b5e093b6b599b84cf299420a54d1a0564387c6584" => :yosemite 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 Label #{plist_name} Program #{opt_bin}/packetbeat RunAtLoad EOS end test do system "#{bin}/packetbeat", "--devices" end end