homebrew-core/Formula/netdata.rb
2018-04-11 14:53:20 +02: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/firehol/netdata/releases/download/v1.10.0/netdata-1.10.0.tar.bz2"
sha256 "70cb42277427b79689f12f3d98b91b500232f8d8a4ad37ee109551352674dd9b"
bottle do
sha256 "f8b4439a962447ce1435e77941f0dba37efa7d157f4a4549accc7aec46a487af" => :high_sierra
sha256 "412b5f85c4a716130452cfe34c19042cfaebcf7dd1cca6941ae19dfca770412d" => :sierra
sha256 "209d7fdd11939267f8a28a5171a55703b3f9588cdbe909bbe2a7800a958d6f98" => :el_capitan
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