summaryrefslogtreecommitdiff
blob: 8574fd7414110796670eceaf810b8b0e5b7a62b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/publicfile/publicfile-0.52-r1.ebuild,v 1.9 2009/01/03 19:48:09 bangert Exp $

inherit eutils

IUSE="selinux"
DESCRIPTION="publish files through FTP and HTTP"
HOMEPAGE="http://cr.yp.to/publicfile.html"
SRC_URI="http://cr.yp.to/publicfile/${P}.tar.gz
	http://www.ohse.de/uwe/patches/${P}-filetype-diff
	http://www.publicfile.org/ftp-ls-patch"
SLOT="0"
LICENSE="as-is"
KEYWORDS="~amd64 hppa ppc sparc x86"

RDEPEND=">=sys-process/daemontools-0.70
	>=sys-apps/ucspi-tcp-0.83
	selinux? ( sec-policy/selinux-publicfile )
	!net-ftp/netkit-ftpd"

src_unpack() {
	unpack publicfile-0.52.tar.gz

	# filetypes in env using daemontools
	cd "${S}"
	epatch "${DISTDIR}"/${P}-filetype-diff

	# "normal" ftp listing
	epatch "${DISTDIR}"/ftp-ls-patch

	echo "gcc ${CFLAGS}" > conf-cc
	echo "gcc" > conf-ld
	echo "/usr" > conf-home

	# fix for glibc-2.3.2 errno issue
	sed -i -e 's|extern int errno;|#include <errno.h>|' error.h
}

src_compile() {
	emake || die "emake failed"
}

src_install() {
	exeinto /usr/bin
	doexe ftpd httpd
	newexe configure publicfile-conf
	dodoc CHANGES FILES README SYSDEPS TARGETS TODO VERSION
}

pkg_preinst() {
	enewgroup nofiles
	enewuser ftp -1 -1 /home/public nofiles
	enewuser ftplog -1 -1 /home/public nofiles
}

pkg_postinst() {
	/usr/bin/publicfile-conf ftp ftplog /home/public `hostname`
	echo
	einfo "httpd and ftpd are serving out of /home/public."
	einfo "remember to start the servers with:"
	einfo "  ln -s /home/public/httpd /home/public/ftpd /service"
	echo
}