summaryrefslogtreecommitdiff
blob: 210876364d4cb71808d9dcecb240d53f5f17e6ef (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
76
77
78
79
80
81
82
83
84
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipac-ng/ipac-ng-1.31-r2.ebuild,v 1.10 2009/01/15 05:25:43 jer Exp $

EAPI="4"
inherit autotools eutils

DESCRIPTION="ip accounting suite for 2.4 and 2.6 series kernels with text and PNG image output like mrtg"
HOMEPAGE="http://sourceforge.net/projects/ipac-ng/"
SRC_URI="mirror://sourceforge/ipac-ng/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc x86"
IUSE="gd gdbm mysql postgres sqlite"

RDEPEND="postgres? ( virtual/postgresql-server )
		mysql? ( virtual/mysql )
		sqlite? ( =dev-db/sqlite-2* )
		gdbm? ( sys-libs/gdbm )"
DEPEND="${RDEPEND}
	sys-devel/bison
	sys-devel/flex"
RDEPEND="${RDEPEND}
	net-firewall/iptables
	virtual/cron
	dev-lang/perl
	gd? ( dev-perl/GD )
	virtual/logger"

src_prepare() {
	# Disable stripping
	sed -e 's/^\(STRIP_DEBUG\)/#\1/' -i Makefile.in || die
	epatch "${FILESDIR}/${P}-as-needed.patch"
	eautoconf

	use postgres || sed 's:test $HAVE_POSTGRE = no:true:' -i configure
	use gdbm || sed 's:test $HAVE_GDBM = no:true:' -i configure
	use mysql || sed 's:test $HAVE_MYSQL = no:true:' -i configure
	use sqlite || sed 's:test $HAVE_SQLITE = no:true:' -i configure
}

src_configure() {
	econf --enable-default-agent=iptables
}

src_test() {
	einfo "self test is broken"
}

src_install() {
	make DESTDIR="${D}" install

	keepdir /var/lib/ipac

	insinto /etc/ipac-ng
	newins "${FILESDIR}"/ipac.conf.1.30 ipac.conf
	newins "${FILESDIR}"/rules.conf.1.30 rules.conf

	newinitd "${FILESDIR}"/ipac-ng.rc.1.30 ipac-ng

	exeinto /etc/cron.hourly
	newexe "${FILESDIR}"/ipac-ng.cron.1.30 ipac-ng

	dodoc README TODO doc/* CHANGELOG
}

pkg_postinst() {
	ewarn
	ewarn "                         W A R N I N G !"
	ewarn "do not use \"/etc/init.d/iptables save\" when ipac-ng is running!"
	ewarn "this WILL save ipac rules and can cause problems!"
	ewarn "ipac-ng should be started AFTER iptables and shut down BEFORE iptables"
	ewarn "use /etc/init.d/iptables save only when ipac rules are removed!"
	ewarn
	elog "the accounting database is at /var/lib/ipac"
	elog "use /usr/sbin/ipacsum to get your ip acounting data"
	elog "use /usr/sbin/fetchipac to update the accounting at any time"
	elog "fetchipac is run by cron every hour by /etc/cron.hourly/ipac-ng"
	elog "after you changed rules.conf you have to run \"fetchipac -S\" or"
	elog "stop/start the service so your iptables gets updated"
	elog "if ipac is not working with the default configuration make"
	elog "rm /etc/ipac-ng/* and rm /var/lib/ipac/* and emerge again"
}