2010-03-12 01:17:21 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Ddclient <Formula
|
2010-03-16 20:16:05 +00:00
|
|
|
url 'http://downloads.sourceforge.net/project/ddclient/ddclient/ddclient-3.8.0/ddclient-3.8.0.tar.bz2'
|
2010-03-12 01:17:21 +00:00
|
|
|
homepage 'http://sourceforge.net/apps/trac/ddclient'
|
|
|
|
md5 '6cac7a5eb1da781bfd4d98cef0b21f8e'
|
|
|
|
|
2010-04-07 05:58:35 +00:00
|
|
|
skip_clean 'etc'
|
|
|
|
skip_clean 'var'
|
2010-03-12 01:17:21 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# Adjust default paths in script
|
|
|
|
inreplace 'ddclient' do |s|
|
|
|
|
s.gsub! "/etc/ddclient", (etc + 'ddclient')
|
|
|
|
s.gsub! "/var/cache/ddclient", (var + 'run/ddclient')
|
|
|
|
end
|
|
|
|
|
|
|
|
# Copy script to sbin
|
|
|
|
sbin.install "ddclient"
|
|
|
|
|
|
|
|
# Install sample files
|
2010-10-21 14:54:17 +00:00
|
|
|
inreplace 'sample-ddclient-wrapper.sh',
|
|
|
|
"/etc/ddclient", (etc + 'ddclient')
|
|
|
|
|
|
|
|
inreplace 'sample-etc_cron.d_ddclient',
|
|
|
|
"/usr/sbin/ddclient", (sbin + 'ddclient')
|
|
|
|
|
|
|
|
inreplace 'sample-etc_ddclient.conf',
|
|
|
|
"/var/run/ddclient.pid", (var + 'run/ddclient/pid')
|
|
|
|
|
|
|
|
(share + 'doc/ddclient').install %w(
|
|
|
|
sample-ddclient-wrapper.sh
|
|
|
|
sample-etc_cron.d_ddclient
|
|
|
|
sample-etc_ddclient.conf
|
|
|
|
)
|
2010-03-12 01:17:21 +00:00
|
|
|
|
|
|
|
# Create etc & var paths
|
|
|
|
(etc + 'ddclient').mkpath
|
|
|
|
(var + 'run/ddclient').mkpath
|
|
|
|
|
|
|
|
# Write the launchd script
|
|
|
|
(prefix + 'org.ddclient.plist').write startup_plist
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS
|
|
|
|
For ddclient to work, you will need to do the following:
|
|
|
|
|
|
|
|
1) Create configuration file in #{etc}/ddclient, sample
|
|
|
|
configuration can be found in #{share}/doc/ddclient
|
|
|
|
|
|
|
|
2) Install the launchd item in /Library/LaunchDaemons, like so:
|
|
|
|
|
|
|
|
sudo cp -vf #{prefix}/org.ddclient.plist /Library/LaunchDaemons/.
|
|
|
|
sudo chown -v root:wheel /Library/LaunchDaemons/org.ddclient.plist
|
|
|
|
|
|
|
|
3) Start the daemon using:
|
|
|
|
|
|
|
|
sudo launchctl load /Library/LaunchDaemons/org.ddclient.plist
|
|
|
|
|
|
|
|
Next boot of system will automatically start ddclient.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def startup_plist
|
|
|
|
return <<-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>
|
2010-10-21 14:54:17 +00:00
|
|
|
<key>Label</key>
|
|
|
|
<string>org.ddclient</string>
|
|
|
|
<key>OnDemand</key>
|
|
|
|
<true/>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{sbin}/ddclient</string>
|
|
|
|
<string>-file</string>
|
|
|
|
<string>#{etc}/ddclient/ddclient.conf</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>StartCalendarInterval</key>
|
|
|
|
<dict>
|
|
|
|
<key>Minute</key>
|
|
|
|
<integer>0</integer>
|
|
|
|
</dict>
|
|
|
|
<key>WatchPaths</key>
|
|
|
|
<array>
|
|
|
|
<string>#{etc}/ddclient</string>
|
|
|
|
</array>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{etc}/ddclient</string>
|
2010-03-12 01:17:21 +00:00
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|