Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 663906
Collapse All | Expand All

(-)a/net-analyzer/barnyard/barnyard-0.2.0-r4.ebuild (+95 lines)
Line 0 Link Here
1
# Copyright 1999-2018 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
4
EAPI=7
5
6
inherit autotools
7
8
DESCRIPTION="Fast output system for Snort"
9
HOMEPAGE="https://sourceforge.net/projects/barnyard"
10
SRC_URI="
11
	mirror://sourceforge/barnyard/barnyard-${PV/_/-}.tar.gz
12
	mirror://gentoo/${P}-patches.tar.bz2"
13
14
SLOT="0"
15
LICENSE="QPL GPL-2"
16
KEYWORDS="~amd64 -sparc ~x86"
17
IUSE="mysql postgres sguil"
18
19
DEPEND="
20
	net-libs/libpcap
21
	postgres? ( dev-db/postgresql[server] )
22
	mysql? ( virtual/mysql )
23
	sguil? ( dev-lang/tcl:0 )"
24
RDEPEND="${DEPEND}
25
	net-analyzer/snort"
26
27
S="${WORKDIR}/${P/_/-}"
28
29
DOCS="AUTHORS README docs/*"
30
31
src_prepare() {
32
	default
33
	eapply "${FILESDIR}/barnyard.64bit.diff"
34
	if use sguil ; then
35
		eapply "${WORKDIR}/${PV}-sguil_files.patch"
36
		eapply "${WORKDIR}/${PV}-configure-in.patch"
37
		cd "${S}/src/output-plugins" || die
38
		eapply "${WORKDIR}/${PV}-op_plugbase.c.patch"
39
		cd "${S}" || die
40
	fi
41
	eautoreconf
42
}
43
44
src_configure() {
45
	local myconf
46
	if use sguil ; then
47
		myconf="--enable-tcl"
48
	fi
49
50
	econf \
51
		${myconf} \
52
		--sysconfdir=/etc/snort \
53
		$(use_enable postgres) \
54
		$(use_enable mysql)
55
}
56
57
src_install () {
58
	default
59
60
	keepdir /var/log/snort
61
	keepdir /var/log/snort/archive
62
63
	insinto /etc/snort
64
	newins etc/barnyard.conf barnyard.conf
65
	if use sguil ; then
66
		sed -i -e "/config hostname:/s%snorthost%$(hostname)%" \
67
		-e "/config interface/s:fxp0:eth0:" \
68
		-e "s:output alert_fast:#output alert_fast:" \
69
		-e "s:output log_dump:#output log_dump:" \
70
			"${D}/etc/snort/barnyard.conf" || die "sed failed"
71
	fi
72
73
	newconfd "${FILESDIR}"/barnyard.confd barnyard
74
	if use sguil ; then
75
		sed -i -e s:/var/log/snort:/var/lib/sguil/$(hostname): \
76
		-e s:/var/run/barnyard.pid:/var/run/sguil/barnyard.pid: \
77
			"${D}/etc/conf.d/barnyard" || die "sed failed"
78
	fi
79
80
	newinitd "${FILESDIR}"/barnyard.rc6 barnyard
81
	if use sguil ; then
82
		sed -i -e "/start-stop-daemon --start/s:--exec:-c sguil --exec:" \
83
			"${D}/etc/init.d/barnyard" || die "sed failed"
84
	fi
85
}
86
87
pkg_postinst() {
88
	if use sguil ; then
89
		elog
90
		elog "Make sure to edit /etc/snort/barnyard.conf and uncomment the"
91
		elog "sguil section along with supplying the appropriate database"
92
		elog "information."
93
		elog
94
	fi
95
}

Return to bug 663906