vnstat 1.15
Closes #4500. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
1c74451de5
commit
a683b37928
1 changed files with 27 additions and 49 deletions
|
@ -1,8 +1,8 @@
|
|||
class Vnstat < Formula
|
||||
desc "Console-based network traffic monitor"
|
||||
homepage "http://humdi.net/vnstat/"
|
||||
url "http://humdi.net/vnstat/vnstat-1.14.tar.gz"
|
||||
sha256 "f8462a47d85d0890493dc9eaeafbc725ae631aa5b103fb7f8af4ddb2314e8386"
|
||||
url "http://humdi.net/vnstat/vnstat-1.15.tar.gz"
|
||||
sha256 "c3814b5baa8b627198a8debfe1dce4b4346a342523818cc8668a5497971dbc39"
|
||||
head "https://github.com/vergoh/vnstat.git"
|
||||
|
||||
bottle do
|
||||
|
@ -16,44 +16,35 @@ class Vnstat < Formula
|
|||
depends_on "gd"
|
||||
|
||||
def install
|
||||
inreplace "src/cfg.c", "/etc/vnstat.conf", "#{etc}/vnstat.conf"
|
||||
|
||||
inreplace "man/vnstat.1" do |s|
|
||||
s.gsub! "/etc/vnstat.conf", "#{etc}/vnstat.conf"
|
||||
s.gsub! "/var/lib/vnstat", "#{var}/db/vnstat"
|
||||
inreplace %w[src/cfg.c src/common.h man/vnstat.1 man/vnstatd.1 man/vnstati.1
|
||||
man/vnstat.conf.5].each do |s|
|
||||
s.gsub! "/etc/vnstat.conf", "#{etc}/vnstat.conf", false
|
||||
s.gsub! "/var/", "#{var}/", false
|
||||
s.gsub! "var/lib", "var/db", false
|
||||
s.gsub! "\"eth0\"", "\"en0\"", false
|
||||
end
|
||||
|
||||
inreplace "man/vnstatd.1" do |s|
|
||||
s.gsub! "/etc/vnstat.conf", "#{etc}/vnstat.conf"
|
||||
s.gsub! "/var/lib/vnstat", "#{var}/db/vnstat"
|
||||
s.gsub! "/var/log/vnstat.log", "#{var}/log/vnstat/vnstat.log"
|
||||
s.gsub! "/var/run/vnstat.pid", "#{var}/run/vnstat/vnstat.pid"
|
||||
end
|
||||
|
||||
inreplace "man/vnstati.1" do |s|
|
||||
s.gsub! "/etc/vnstat.conf", "#{etc}/vnstat.conf"
|
||||
s.gsub! "/var/lib/vnstat", "#{var}/db/vnstat"
|
||||
end
|
||||
|
||||
inreplace "man/vnstat.conf.5", "/etc/vnstat.conf", "#{etc}/vnstat.conf"
|
||||
|
||||
inreplace "cfg/vnstat.conf" do |c|
|
||||
c.gsub! 'Interface "eth0"', %(Interface "en0")
|
||||
c.gsub! 'DatabaseDir "/var/lib/vnstat"', %(DatabaseDir "#{var}/db/vnstat")
|
||||
c.gsub! 'LogFile "/var/log/vnstat/vnstat.log"', %(LogFile "#{var}/log/vnstat/vnstat.log")
|
||||
c.gsub! 'PidFile "/var/run/vnstat/vnstat.pid"', %(PidFile "#{var}/run/vnstat/vnstat.pid")
|
||||
end
|
||||
|
||||
(var/"db/vnstat").mkpath
|
||||
|
||||
system "make", "all", "-C", "src", "CFLAGS=#{ENV.cflags}", "CC=#{ENV.cc}"
|
||||
etc.install "cfg/vnstat.conf"
|
||||
bin.install "src/vnstat", "src/vnstatd", "src/vnstati"
|
||||
man1.install "man/vnstat.1", "man/vnstatd.1", "man/vnstati.1"
|
||||
man5.install "man/vnstat.conf.5"
|
||||
system "./configure", "--disable-dependency-tracking",
|
||||
"--disable-silent-rules",
|
||||
"--prefix=#{prefix}",
|
||||
"--sysconfdir=#{etc}",
|
||||
"--sbindir=#{bin}",
|
||||
"--localstatedir=#{var}"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
plist_options :startup => true
|
||||
def post_install
|
||||
(var/"db/vnstat").mkpath
|
||||
(var/"log/vnstat").mkpath
|
||||
(var/"run/vnstat").mkpath
|
||||
end
|
||||
|
||||
def caveats; <<-EOS.undent
|
||||
To monitor interfaces other than "en0" edit #{etc}/vnstat.conf
|
||||
EOS
|
||||
end
|
||||
|
||||
plist_options :startup => true, :manual => "#{HOMEBREW_PREFIX}/opt/vnstat/bin/vnstatd --nodaemon --config #{HOMEBREW_PREFIX}/etc/vnstat.conf"
|
||||
|
||||
def plist; <<-EOS.undent
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -73,10 +64,6 @@ class Vnstat < Formula
|
|||
<true/>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>UserName</key>
|
||||
<string>$USER</string>
|
||||
<key>GroupName</key>
|
||||
<string>staff</string>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>#{var}</string>
|
||||
<key>ProcessType</key>
|
||||
|
@ -86,15 +73,6 @@ class Vnstat < Formula
|
|||
EOS
|
||||
end
|
||||
|
||||
def post_install
|
||||
inreplace prefix/"homebrew.mxcl.vnstat.plist", "$USER", ENV["USER"]
|
||||
end
|
||||
|
||||
def caveats; <<-EOS.undent
|
||||
To monitor interfaces other than "en0" edit #{etc}/vnstat.conf
|
||||
EOS
|
||||
end
|
||||
|
||||
test do
|
||||
cp etc/"vnstat.conf", testpath
|
||||
inreplace "vnstat.conf", "/usr/local/var", testpath/"var"
|
||||
|
|
Loading…
Reference in a new issue