1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit eutils toolchain-funcs
7 DESCRIPTION="Very Secure FTP Daemon with devnet patchset"
8 HOMEPAGE="http://vsftpd.devnet.ru/"
9 SRC_URI="http://vsftpd.devnet.ru/files/${PV%_p*}/ext.${PV#*_p}/${PN%-*}-${PV%_p*}-ext${PV#*_p}.tgz"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="caps pam tcpd ssl selinux xinetd"
16 DEPEND="caps? ( sys-libs/libcap )
18 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
19 ssl? ( >=dev-libs/openssl-0.9.7d )"
23 selinux? ( sec-policy/selinux-ftpd )
24 xinetd? ( sys-apps/xinetd )"
26 S=${WORKDIR}/${PN%-*}-${PV%_p*}-ext.${PV#*_p}
32 # Patch the source, config and the manpage to use /etc/vsftpd/
33 epatch "${FILESDIR}/${PN}-2.1.0-gentoo.patch"
35 # Configure vsftpd build defaults
36 use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
37 use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
38 use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
40 # Ensure that we don't link against libcap unless asked
42 sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c
43 epatch "${FILESDIR}"/${PN}-2.1.0-dont-link-caps.patch
46 # Let portage control stripping
47 sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile
48 # disabling background by default
49 sed -i 's/background = 1/background = 0/' tunables.c
53 emake CFLAGS="${CFLAGS}" CC="$(tc-getCC)" || die
57 doman vsftpd.conf.5 vsftpd.8 || die
60 dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
61 README README.security REWARD SIZE \
62 SPEED TODO TUNING || die
63 newdoc vsftpd.conf vsftpd.conf.example || die
66 dodoc SECURITY/* || die
68 insinto "/usr/share/doc/${PF}/examples"
69 doins -r EXAMPLE/* || die
72 newins vsftpd.conf vsftpd.conf.example || die
74 insinto /etc/logrotate.d
75 newins "${FILESDIR}/vsftpd.logrotate" vsftpd || die
79 newins "${FILESDIR}/vsftpd.xinetd" vsftpd || die
82 newinitd "${FILESDIR}/vsftpd.init" vsftpd || die
84 keepdir /usr/share/vsftpd/empty
88 # If we use xinetd, then we comment out listen=YES
89 # so that our default config works under xinetd - fixes #78347
91 sed -i '/\listen=YES/s/^/#/g' "${D}"/etc/vsftpd/vsftpd.conf.example
94 einfo "vsftpd init script can now be multiplexed."
95 einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
96 einfo "If you symlink the init script to another one, say vsftpd.foo"
97 einfo "then that uses /etc/vsftpd/foo.conf instead."
100 einfo " cd /etc/init.d"
101 einfo " ln -s vsftpd vsftpd.foo"
102 einfo "You can now treat vsftpd.foo like any other service"