homebrew-core/Formula/netdata.rb
2018-11-25 11:03:32 -05:00

65 lines
2.2 KiB
Ruby

class Netdata < Formula
desc "Distributed real-time performance and health monitoring"
homepage "https://my-netdata.io/"
url "https://github.com/netdata/netdata/releases/download/v1.11.1/netdata-v1.11.1.tar.gz"
sha256 "0150b2a060da0e5cc844bd9540d6704cd352c434ea1bb9d5268131830a815736"
bottle do
sha256 "5c7c86d146d3d73fa791f30014242ed796a38809a3301a88f62555b8b20eb8bf" => :mojave
sha256 "c577f25eaf5ae01cabcb62c428a2b1806be2f55f919d2fb5fe8c26e1b4957b4a" => :high_sierra
sha256 "2523906ac43fe8bb4407efeee529744b5842c01113aa9f551d5f065e1376eeb7" => :sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "ossp-uuid"
def install
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"
system "make", "install"
(etc/"netdata").install "system/netdata.conf"
end
def post_install
config = etc/"netdata/netdata.conf"
inreplace config do |s|
s.gsub!(/web files owner = .*/, "web files owner = #{ENV["USER"]}")
s.gsub!(/web files group = .*/, "web files group = #{Etc.getgrgid(prefix.stat.gid).name}")
end
end
plist_options :manual => "#{HOMEBREW_PREFIX}/sbin/netdata -D"
def plist; <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/netdata</string>
<string>-D</string>
</array>
<key>WorkingDirectory</key>
<string>#{var}</string>
</dict>
</plist>
EOS
end
test do
system "#{sbin}/netdata", "-W", "set", "registry", "netdata unique id file",
"#{testpath}/netdata.unittest.unique.id",
"-W", "unittest"
end
end