require "formula" class Knot < Formula homepage "https://www.knot-dns.cz/" url "https://secure.nic.cz/files/knot-dns/knot-1.4.3.tar.gz" sha1 "c9b5598688cbd0b97efabe595244c3bf79273e3a" depends_on "userspace-rcu" depends_on "openssl" depends_on "libidn" def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--with-configdir=#{etc}", "--with-storage=#{var}/knot", "--with-rundir=#{var}/knot", "--prefix=#{prefix}" inreplace 'samples/Makefile', 'install-data-local:', 'disable-install-data-local:' system "make" system "make", "install" (buildpath + 'knot.conf').write(knot_conf) etc.install 'knot.conf' (var + 'knot').mkpath end def knot_conf; <<-EOS.undent system { identity on; version on; rundir "#{var}/knot"; } interfaces { all_ipv4 { address 0.0.0.0; port 53; } all_ipv6 { address [::]; port 53; } } control { listen-on "knot.sock"; } zones { storage "#{var}/knot"; # example.com { # file "#{var}/knot/example.com.zone"; # } } log { syslog { any error; zone warning, notice; server info; } stderr { any error, warning; } } EOS end plist_options :startup => true def plist; <<-EOS.undent EnableTransactions Label #{plist_name} RunAtLoad ProgramArguments #{opt_prefix}/sbin/knotd -c #{etc}/knot.conf ServiceIPC EOS end test do system "#{bin}/kdig", "www.knot-dns.cz" system "#{bin}/khost", "brew.sh" system "#{sbin}/knotc", "-c", "#{etc}/knot.conf", "checkconf" end end