77 lines
2.7 KiB
Ruby
77 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.16.0/netdata-v1.16.0.tar.gz"
|
|
sha256 "d62ae89c7b9e93d40feca6edd26b77c6e27e17caa2f90a50a1a7a677f6cc8b4f"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 "1d937ea324ae760ddd986f6ac3ff3cda572335f597feb4b6c5acccf3dd8b8c26" => :mojave
|
|
sha256 "61935ea0123e116f21631f0a3b11fc2d694e23ed620107002d6b6dba1d9d1300" => :high_sierra
|
|
sha256 "028e79b7fe6d46bf33bc466d2e63180c6af50c328284434eb3bad5a45ce30bf7" => :sierra
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "openssl" 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
|