leafnode: add plist files (#2432)

This commit is contained in:
Rakesh 2016-10-15 16:19:22 +05:30 committed by Mike McQuaid
parent 3817a2df23
commit dbd98ef0e0

View file

@ -14,6 +14,89 @@ class Leafnode < Formula
"--with-user=#{ENV["USER"]}", "--with-group=admin",
"--sysconfdir=#{etc}/leafnode", "--with-spooldir=#{var}/spool/news/leafnode"
system "make", "install"
(prefix/"homebrew.mxcl.fetchnews.plist").write fetchnews_plist
(prefix/"homebrew.mxcl.texpire.plist").write texpire_plist
end
def caveats; <<-EOS.undent
For starting fetchnews and texpire, create links,
ln -s #{opt_prefix}/homebrew.mxcl.{fetchnews,texpire}.plist ~/Library/LaunchAgents
And to start the services,
launchctl load -w ~/Library/LaunchAgent/homebrew.mxcl.{fetchnews,texpire}.plist
EOS
end
plist_options :manual => "leafnode"
def plist; <<-EOS.undent
<?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>OnDemand</key>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
<string>#{opt_sbin}/leafnode</string>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>nntp</string>
</dict>
</dict>
<key>WorkingDirectory</key>
<string>#{var}/spool/news</string>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
</dict>
</plist>
EOS
end
def fetchnews_plist; <<-EOS.undent
<?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>KeepAlive</key>
<false/>
<key>Label</key>
<string>homebrew.mxcl.fetchnews</string>
<key>Program</key>
<string>#{opt_sbin}/fetchnews</string>
<key>StartInterval</key>
<integer>1800</integer>
<key>WorkingDirectory</key>
<string>#{var}/spool/news</string>
</dict>
</plist>
EOS
end
def texpire_plist; <<-EOS.undent
<?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>KeepAlive</key>
<false/>
<key>Label</key>
<string>homebrew.mxcl.texpire</string>
<key>Program</key>
<string>#{opt_sbin}/texpire</string>
<key>StartInterval</key>
<integer>25000</integer>
<key>WorkingDirectory</key>
<string>#{var}/spool/news</string>
</dict>
</plist>
EOS
end
test do