homebrew-core/Formula/daemontools.rb

70 lines
1.9 KiB
Ruby

class Daemontools < Formula
desc "Collection of tools for managing UNIX services"
homepage "https://cr.yp.to/daemontools.html"
url "https://cr.yp.to/daemontools/daemontools-0.76.tar.gz"
sha256 "a55535012b2be7a52dcd9eccabb9a198b13be50d0384143bd3b32b8710df4c1f"
revision 1
bottle do
cellar :any_skip_relocation
sha256 "9481a0cc89388de2cb60631505e1a9f865ee33b1ae3600a054d2cfab9826eaa8" => :big_sur
sha256 "650688484d7de25a026916c90a0109f05d33ec8401cc007e6ae805d2cedb9a16" => :catalina
sha256 "d34c1e242009de743a2d58fc52bf56cd24a69eb940f74bf8af2b168f76010dd1" => :mojave
sha256 "a5a9bd96a04e3cbcbb15170bb7af3b7128e85d1e9c23b18bf0a76922f3beaff0" => :high_sierra
end
def install
cd "daemontools-#{version}" do
inreplace ["package/run", "src/svscanboot.sh"] do |s|
s.gsub! "/service", "#{etc}/service"
end
system "package/compile"
bin.install Dir["command/*"]
end
end
def post_install
(etc/"service").mkpath
Pathname.glob("/service/*") do |original|
target = "#{etc}/service/#{original.basename}"
ln_s original, target unless File.exist?(target)
end
end
def caveats
<<~EOS
Services are stored in:
#{etc}/service/
EOS
end
plist_options startup: true
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>ProgramArguments</key>
<array>
<string>#{opt_bin}/svscanboot</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
EOS
end
test do
assert_match /Homebrew/, shell_output("#{bin}/softlimit -t 1 echo 'Homebrew'")
end
end