homebrew-core/Formula/pure-ftpd.rb

81 lines
2.3 KiB
Ruby
Raw Normal View History

require 'formula'
class PureFtpd < Formula
url 'http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.35.tar.gz'
homepage 'http://www.pureftpd.org/'
md5 'fa53507ff8e9fdca0197917ec8d106a3'
def install
args = ["--disable-dependency-tracking",
2012-03-03 23:50:27 +00:00
"--prefix=#{prefix}",
"--mandir=#{man}",
"--sysconfdir=#{etc}",
"--with-pam",
"--with-altlog",
"--with-puredb",
"--with-throttling",
"--with-ratios",
"--with-quotas",
"--with-ftpwho",
"--with-virtualhosts",
"--with-virtualchroot",
"--with-diraliases",
"--with-peruserlimits",
"--with-tls",
"--with-bonjour"]
2012-03-03 23:50:27 +00:00
args << "--with-pgsql" if which 'pg_config'
args << "--with-mysql" if which 'mysql'
system "./configure", *args
system "make install"
plist_path.write startup_plist
plist_path.chmod 0644
end
2012-03-03 23:50:27 +00:00
def caveats; <<-EOS.undent
If this is your first install, automatically load on login with:
2012-03-03 23:50:27 +00:00
mkdir -p ~/Library/LaunchAgents
cp #{plist_path} ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
If this is an upgrade and you already have the #{plist_path.basename} loaded:
2012-03-03 23:50:27 +00:00
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
cp #{plist_path} ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
2012-03-03 23:50:27 +00:00
To start pure-ftpd manually:
pure-ftpd <options>
EOS
end
2012-03-03 23:50:27 +00:00
def startup_plist; <<-EOPLIST
<?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>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{HOMEBREW_PREFIX}/sbin/pure-ftpd</string>
<string>-A -j -z</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>#{`whoami`.chomp}</string>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/pure-ftpd.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/pure-ftpd.log</string>
</dict>
</plist>
EOPLIST
end
end