summaryrefslogtreecommitdiff
blob: 44b8c70968b1820d206a2c480f275e7b730069c9 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/arpwatch/arpwatch-2.1.15-r4.ebuild,v 1.7 2007/05/05 17:59:43 nixnut Exp $

inherit eutils versionator

PATCH_VER="0.4"

MY_P="${PN}-$(replace_version_separator 2 'a')"
DESCRIPTION="An ethernet monitor program that keeps track of ethernet/ip address pairings"
HOMEPAGE="http://www-nrg.ee.lbl.gov/"
SRC_URI="ftp://ftp.ee.lbl.gov/${MY_P}.tar.gz
	mirror://gentoo/arpwatch-patchset-${PATCH_VER}.tbz2"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 hppa ppc sparc x86"
IUSE="selinux"

DEPEND="virtual/libpcap
	sys-libs/ncurses"

RDEPEND="${DEPEND}
		selinux? ( sec-policy/selinux-arpwatch )"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"

	EPATCH_SOURCE="${WORKDIR}"/arpwatch-patchset/
	EPATCH_SUFFIX="patch"
	epatch
	cp "${WORKDIR}"/arpwatch-patchset/*.8 . || die "Failed to get man-pages from arpwatch-patchset."
}

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

src_install () {
	dosbin arpwatch arpsnmp arp2ethers massagevendor arpfetch bihourly.sh
	doman arpwatch.8 arpsnmp.8 arp2ethers.8 massagevendor.8 arpfetch.8 bihourly.8

	insinto /usr/share/arpwatch
	doins ethercodes.dat

	insinto /usr/share/arpwatch/awk
	doins duplicates.awk euppertolower.awk p.awk e.awk d.awk

	keepdir /var/lib/arpwatch
	dodoc README CHANGES

	newinitd "${FILESDIR}"/arpwatch.init-2 arpwatch
	newconfd "${FILESDIR}"/arpwatch.confd arpwatch
}

pkg_config() {
	enewgroup arpwatch
	enewuser arpwatch -1 -1 /var/lib/arpwatch arpwatch

	einfo "Setting permitions for data directory"
	chown -R arpwatch:arpwatch /var/lib/arpwatch

	cat >> /etc/conf.d/arpwatch << EOF

# Uncomment this line if you wish arpwatch to drop privileges.
ARPUSER="arpwatch"
EOF
	einfo "Done."
}

pkg_postinst() {
	elog "For security reasons it is better to run arpwatch as an unprivileged user."
	elog "If you wish to do so, please, run:"
	elog "      emerge --config arpwatch"
	echo
	ewarn "Note: some scripts require snmpwalk utility from net-analyzer/net-snmp"
}