2010-03-12 01:17:21 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Ddclient < Formula
|
2014-04-29 17:22:46 +00:00
|
|
|
homepage 'http://sourceforge.net/p/ddclient/wiki/Home'
|
2014-02-27 14:19:55 +00:00
|
|
|
url 'https://downloads.sourceforge.net/project/ddclient/ddclient/ddclient-3.8.2/ddclient-3.8.2.tar.bz2'
|
2014-01-16 06:49:24 +00:00
|
|
|
sha1 '8c887c06a580773c48a1eaced82a08c3077e1325'
|
2010-03-12 01:17:21 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# Adjust default paths in script
|
|
|
|
inreplace 'ddclient' do |s|
|
2012-03-11 03:33:16 +00:00
|
|
|
s.gsub! "/etc/ddclient", "#{etc}/ddclient"
|
|
|
|
s.gsub! "/var/cache/ddclient", "#{var}/run/ddclient"
|
2010-03-12 01:17:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
sbin.install "ddclient"
|
|
|
|
|
|
|
|
# Install sample files
|
2010-10-21 14:54:17 +00:00
|
|
|
inreplace 'sample-ddclient-wrapper.sh',
|
2012-03-11 03:33:16 +00:00
|
|
|
"/etc/ddclient", "#{etc}/ddclient"
|
2010-10-21 14:54:17 +00:00
|
|
|
|
|
|
|
inreplace 'sample-etc_cron.d_ddclient',
|
2012-03-11 03:33:16 +00:00
|
|
|
"/usr/sbin/ddclient", "#{sbin}/ddclient"
|
2010-10-21 14:54:17 +00:00
|
|
|
|
|
|
|
inreplace 'sample-etc_ddclient.conf',
|
2012-03-11 03:33:16 +00:00
|
|
|
"/var/run/ddclient.pid", "#{var}/run/ddclient/pid"
|
2010-10-21 14:54:17 +00:00
|
|
|
|
2012-03-11 03:33:16 +00:00
|
|
|
(share+'doc/ddclient').install %w(
|
2010-10-21 14:54:17 +00:00
|
|
|
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
|
2012-03-11 03:33:16 +00:00
|
|
|
(etc+'ddclient').mkpath
|
|
|
|
(var+'run/ddclient').mkpath
|
2010-03-12 01:17:21 +00:00
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
For ddclient to work, you will need to create a configuration file
|
|
|
|
in #{etc}/ddclient, a sample configuration can be found in
|
2014-03-06 05:28:31 +00:00
|
|
|
#{opt_share}/doc/ddclient.
|
2010-03-12 01:17:21 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
Note: don't enable daemon mode in the configuration file; see
|
|
|
|
additional information below.
|
2011-04-19 19:51:16 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
The next reboot of the system will automatically start ddclient.
|
2010-03-12 01:17:21 +00:00
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
You can adjust the execution interval by changing the value of
|
|
|
|
StartInterval (in seconds) in /Library/LaunchDaemons/#{plist_path.basename},
|
|
|
|
and then
|
|
|
|
EOS
|
2010-03-12 01:17:21 +00:00
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
plist_options :startup => true
|
|
|
|
|
|
|
|
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>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
2014-03-06 05:28:31 +00:00
|
|
|
<string>#{opt_sbin}/ddclient</string>
|
2012-11-25 15:06:41 +00:00
|
|
|
<string>-file</string>
|
|
|
|
<string>#{etc}/ddclient/ddclient.conf</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>StartInterval</key>
|
|
|
|
<integer>300</integer>
|
|
|
|
<key>WatchPaths</key>
|
|
|
|
<array>
|
|
|
|
<string>#{etc}/ddclient</string>
|
|
|
|
</array>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{etc}/ddclient</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
2010-03-12 01:17:21 +00:00
|
|
|
end
|
|
|
|
end
|