summaryrefslogtreecommitdiff
blob: 68052fcf99c16c7943cdb518645617b7079d3ea9 (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
65
66
67
68
69
70
71
72
73
74
75
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-nntp/nntpswitch/nntpswitch-0.11.ebuild,v 1.1 2005/01/17 19:40:02 swegener Exp $

DESCRIPTION="Load Balancing NNTP Router"
HOMEPAGE="http://www.nntpswitch.org/"
SRC_URI="http://www.nntpswitch.org/download/${P}.tar.gz"
LICENSE="as-is"
SLOT="0"
KEYWORDS="~x86"
IUSE="ldap mysql postgres"

RDEPEND="mysql? ( dev-db/mysql )
	postgres? ( dev-db/postgresql )
	ldap? ( net-nds/openldap )"

DEPEND="${RDEPEND}
	>=sys-apps/sed-4"

S=${WORKDIR}/${PN}

src_unpack() {
	unpack ${A}

	sed -i \
		-e "s/-O3/${CFLAGS}/" \
		-e "s:lib/nntpswitch:$(get_libdir)/nntpswitch:" \
		${S}/Makefile
	sed -i \
		-e "s:/usr/local/lib:/usr/$(get_libdir)/nntpswitch:" \
		${S}/nntpswitch.conf.in
	sed -i \
		-e "s:/usr/local/etc/nntpswitch/passwd:/etc/nntpswitch/passwd:" \
		${S}/etc/access.conf
}

src_compile() {
	emake -j1 || die "emake failed"

	if use mysql
	then
		emake -j1 mysql || die "emake mysql failed"
	fi
	if use postgres
	then
		emake -j1 postgres || die "emake postgres failed"
	fi
	if use ldap
	then
		emake -j1 ldap || die "emake ldap failed"
	fi
}

src_install() {
	dodir /usr/sbin /usr/$(get_libdir)/nntpswitch
	make PREFIX="${D}/usr" install || die "make install failed"

	insinto /etc/nntpswitch
	newins nntpswitch.conf-dist nntpswitch.conf || die "newins failed"
	doins etc/{{access,servers}.conf,passwd,overview.fmt} || die "doins failed"

	keepdir /var/lib/nntpswitch || die "keepdir failed"
	dosym /var/lib/nntpswitch/active /etc/nntpswitch/active || die "dosym failed"
	dosym /var/lib/nntpswitch/newsgroups /etc/nntpswitch/newsgroups || die "dosym failed"

	newinitd ${FILESDIR}/nntpswitch.init.d nntpswitch || die "newinitd failed"
}

pkg_postinst() {
	einfo "Please configure nntpswitch using the files in /etc/nntpswitch!"
	einfo
	einfo "After this, you need to generate a nntpswitch-compatible active file,"
	einfo "before you can start nntpswitch for the first time. Use 'updategroups'"
	einfo "to perform this step."
}