homebrew-core/Formula/netdata.rb
2019-10-22 16:33:24 -04:00

76 lines
2.7 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.18.1/netdata-v1.18.1.tar.gz"
sha256 "39cca83e810296177ea255deef9961631480cb911da68dde7ac5a339cc95e521"
bottle do
sha256 "92ae4eea497275834c69d0c26f3296e5d6b53748618a7275caea017a555e4c26" => :catalina
sha256 "b6dc94b9cb4b122f256ed108c72d16aee9d7ce165064e19cac6306e609ba066e" => :mojave
sha256 "e37c39bba4f892a24655cf8337a9c4c60c90183e066b5eb0a507135e8337aff3" => :high_sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "openssl@1.1" if MacOS.version <= :sierra
def install
system "autoreconf", "-ivf"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}",
"--libexecdir=#{libexec}",
"--with-math",
"--with-zlib",
"--with-user=netdata",
"UUID_CFLAGS=-I/usr/include",
"UUID_LIBS=-lc"
system "make", "clean"
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
(var/"netdata").mkpath
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", "set", "registry", "netdata management api key file",
"#{testpath}/netdata.api.key",
"-W", "unittest"
end
end