1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils systemd toolchain-funcs
8 DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
9 HOMEPAGE="http://vsftpd.beasts.org/"
10 SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
14 KEYWORDS="~alpha amd64 arm hppa ~ia64 ppc ppc64 s390 sparc x86"
15 IUSE="caps libressl pam tcpd ssl selinux xinetd"
17 DEPEND="caps? ( >=sys-libs/libcap-2 )
19 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
21 !libressl? ( dev-libs/openssl:0= )
22 libressl? ( dev-libs/libressl:0= )
26 selinux? ( sec-policy/selinux-ftp )
27 xinetd? ( sys-apps/xinetd )"
31 # kerberos patch. bug #335980
32 "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
34 # Patch the source, config and the manpage to use /etc/vsftpd/
35 "${FILESDIR}/${PN}-2.3.5-gentoo.patch"
37 # Fix building without the libcap
38 "${FILESDIR}/${PN}-2.1.0-caps.patch"
40 # Fix building on alpha. Bug #405829
41 "${FILESDIR}/${PN}-3.0.2-alpha.patch"
44 "${FILESDIR}"/${PN}-3.0.0-Makefile.patch
47 "${FILESDIR}"/${PN}-3.0.2-remove-legacy-cap.patch
50 "${FILESDIR}"/${PN}-3.0.3-sparc.patch
52 # https://bugs.gentoo.org/443898
53 "${FILESDIR}"/vsftpd-disable-seccomp-sandbox.patch
56 # Configure vsftpd build defaults
57 use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
58 use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
59 use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
61 # Ensure that we don't link against libcap unless asked
63 sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
64 eapply "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
67 # Let portage control stripping
68 sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
74 # Override LIBS variable. Bug #508192
76 use caps && LIBS+=" -lcap"
77 use pam && LIBS+=" -lpam"
78 use tcpd && LIBS+=" -lwrap"
79 use ssl && LIBS+=" -lssl -lcrypto"
88 doman ${PN}.conf.5 ${PN}.8
91 dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
92 README README.security REWARD SIZE \
93 SPEED TODO TUNING || die "dodoc failed"
94 newdoc ${PN}.conf ${PN}.conf.example
99 insinto "/usr/share/doc/${PF}/examples"
103 newins ${PN}.conf{,.example}
105 insinto /etc/logrotate.d
106 newins "${FILESDIR}/${PN}.logrotate" ${PN}
109 insinto /etc/xinetd.d
110 newins "${FILESDIR}/${PN}.xinetd" ${PN}
113 newinitd "${FILESDIR}/${PN}.init" ${PN}
115 keepdir /usr/share/${PN}/empty
118 doexe "${FILESDIR}/vsftpd-checkconfig.sh"
119 systemd_dounit "${FILESDIR}/${PN}.service"
120 systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
121 systemd_dounit "${FILESDIR}/${PN}.socket"
125 # If we use xinetd, then we set listen=NO
126 # so that our default config works under xinetd - fixes #78347
128 sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
133 einfo "vsftpd openRC init script can now be multiplexed."
134 einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
135 einfo "If you symlink the init script to another one, say vsftpd.foo"
136 einfo "then that uses /etc/vsftpd/foo.conf instead."
139 einfo " cd /etc/init.d"
140 einfo " ln -s vsftpd vsftpd.foo"
141 einfo "You can now treat vsftpd.foo like any other service"