70 lines
2.5 KiB
Ruby
70 lines
2.5 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.15.0/netdata-v1.15.0.tar.gz"
|
|
sha256 "7d2f25c62003ea96669e460ec96b69a9616c9ddd6f48a48707a79a898077d911"
|
|
|
|
bottle do
|
|
sha256 "3e0b138f7a27872498836e0fc0a7bd32a17c2005f20ae3b98e27473794fcb537" => :mojave
|
|
sha256 "6250f3a0b6f5415f87243694e68e9aaba4d7bccaa94dab6aecbd9e1aade6d3e8" => :high_sierra
|
|
sha256 "6afd0618b54d247d7083ae3ce7fc47a1f36c62fd92483993b138ebc21f057250" => :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 "./configure", "--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{prefix}",
|
|
"--sysconfdir=#{etc}",
|
|
"--localstatedir=#{var}",
|
|
"UUID_CFLAGS=-I/usr/include",
|
|
"UUID_LIBS=-lc"
|
|
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
|