summaryrefslogtreecommitdiff
blob: f3a3a80be3c35b7ab6c2e2523f1abc703c91ad02 (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-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/mwcollect/mwcollect-3.0.0.ebuild,v 1.1 2005/11/30 10:12:29 chriswhite Exp $

inherit eutils

DESCRIPTION="mwcollect collects worms and other autonomous spreading malware"
HOMEPAGE="http://www.mwcollect.org/"
SRC_URI="http://download.mwcollect.org/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~ppc ~x86"
IUSE="debug"

DEPEND="dev-libs/libpcre
	net-misc/curl
	>=sys-libs/libcap-1"
RDEPEND=""

src_unpack() {
	unpack ${A}
	cd ${S}
	sed -i \
	-e "s:CXXFLAGS += -I./src/include:CXXFLAGS += ${CXXFLAGS} -I./src/include:" \
	Makefile || die "custom CFLAGS patching failed"

	sed -i \
	-e "s:\$(MODULE_OBJ) \$(LDFLAGS):\$(MODULE_OBJ) \$(LDFLAGS) -fPIC:" \
	Makefile.MODULE || die "pic patching failed"

	sed -i \
	-e "s:%loadModule(\":%loadModule(\"\/usr\/lib\/mwcollect\/:g" \
	conf/mwcollect.conf || die "module load directory failed"

	# sets CAP_SETUID for setresuid
	epatch "${FILESDIR}"/${P}-capacity.patch
}

src_compile() {
	if use debug
	then
		emake DEBUG="y" || die "Make failed"
	else
		emake || die "Make failed"
	fi
}

src_install() {
	dosbin bin/mwcollectd
	insinto /usr/$(get_libdir)/mwcollect
	doins bin/modules/*

	insinto /etc/mwcollect
	doins conf/* \
		|| die "config file installation failed"

	dodoc README* doc/core-design.txt
	mv doc/mwcollectd.1.man doc/mwcollectd.1
	doman doc/mwcollectd.1

	newinitd ${FILESDIR}/initd mwcollectd
	insinto /etc/conf.d
	newins ${FILESDIR}/confd mwcollectd
}