70 lines
2.4 KiB
Ruby
70 lines
2.4 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.14.0/netdata-v1.14.0.tar.gz"
|
|
sha256 "f3768f6927e3712dce73794c6943a12f4454410c872eb3dfd19af4f52296187a"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "41b7ad105a34c6d08504b519fdd831083f2e5eafae50e56dbb5f2764bf42fb3e" => :mojave
|
|
sha256 "c299b09c4c8d92b12ccce72ed891b45d639929c3f47f016578feaeb7a1018dc2" => :high_sierra
|
|
sha256 "cb8bade65cc8b64db20560f5e1ef9b74656a8e04f9ca520fbc029f6ee816f2a7" => :sierra
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
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
|