/
packetbeat-full.rb
51 lines (45 loc) · 1.51 KB
/
packetbeat-full.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class PacketbeatFull < Formula
desc "Lightweight Shipper for Network Data"
homepage "https://www.elastic.co/products/beats/packetbeat"
url "https://artifacts.elastic.co/downloads/beats/packetbeat/packetbeat-7.10.2-darwin-x86_64.tar.gz?tap=elastic/homebrew-tap"
version "7.10.2"
sha256 "5376dbfaaaa803264ed087f0e521852895836a6cb2a30921b1c596e49e2af4ef"
conflicts_with "packetbeat"
conflicts_with "packetbeat-oss"
bottle :unneeded
def install
["fields.yml", "ingest", "kibana", "module"].each { |d| libexec.install d if File.exist?(d) }
(libexec/"bin").install "packetbeat"
(etc/"packetbeat").install "packetbeat.yml"
(etc/"packetbeat").install "modules.d" if File.exist?("modules.d")
(bin/"packetbeat").write <<~EOS
#!/bin/sh
exec #{libexec}/bin/packetbeat \
--path.config #{etc}/packetbeat \
--path.data #{var}/lib/packetbeat \
--path.home #{libexec} \
--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