homebrew-core/Formula/vsftpd.rb

81 lines
2.6 KiB
Ruby

class Vsftpd < Formula
desc "Secure FTP server for UNIX"
homepage "https://security.appspot.com/vsftpd.html"
url "https://security.appspot.com/downloads/vsftpd-3.0.3.tar.gz"
mirror "https://fossies.org/linux/misc/vsftpd-3.0.3.tar.gz"
sha256 "9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7"
license "GPL-2.0-only"
livecheck do
url :homepage
regex(/href=.*?vsftpd[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 3
sha256 arm64_big_sur: "b4db372cd088914a87f7c103eaed341550041af0d76e491a6d92b835f61285b6"
sha256 big_sur: "40acdd9e273725a5338036bc7cb79af8c1978a9d18eefab2b735591b0bf5176d"
sha256 catalina: "48478d6f73d9fa182c6597de7f195ab659879dbb301a70aa5e306d496331aebd"
sha256 mojave: "156a4b41142d78d359c2a6c17b9aa3cca5a00e56fe01c2188dcc224735c0fdeb"
end
uses_from_macos "perl" => :build
# Patch to remove UTMPX dependency, locate macOS's PAM library, and
# remove incompatible LDFLAGS. (reported to developer via email)
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/5fbea7b01a521f840f51be6ffec29f612a37eed3/vsftpd/3.0.3.patch"
sha256 "c158fac428e06e16219e332c3897c3f730586e55d0ef3a670ed3c716e3de5371"
end
def install
inreplace "defs.h", "/etc/vsftpd.conf", "#{etc}/vsftpd.conf"
inreplace "tunables.c", "/etc", etc
inreplace "tunables.c", "/var", var
system "make"
# make install has all the paths hardcoded; this is easier:
sbin.install "vsftpd"
etc.install "vsftpd.conf"
man5.install "vsftpd.conf.5"
man8.install "vsftpd.8"
end
def caveats
<<~EOS
To use chroot, vsftpd requires root privileges, so you will need to run
`sudo vsftpd`.
You should be certain that you trust any software you grant root privileges.
The vsftpd.conf file must be owned by root or vsftpd will refuse to start:
sudo chown root #{HOMEBREW_PREFIX}/etc/vsftpd.conf
EOS
end
plist_options startup: true, manual: "sudo vsftpd"
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>#{sbin}/vsftpd</string>
<string>#{etc}/vsftpd.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
assert_match version.to_s, shell_output("#{sbin}/vsftpd -v 0>&1")
end
end