summaryrefslogtreecommitdiff
blob: 9d369c9fc41d64a14dd20af6a62373c6e20c8fc9 (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-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=4

inherit base toolchain-funcs user

DESCRIPTION="System & Network Integrated Polling Software"
HOMEPAGE="http://www.netplex-tech.com/snips/"
SRC_URI="http://www.netplex-tech.com/software/downloads/${PN}/${P}.tar.gz"

LICENSE="SNIPS BSD HPND GPL-1+ RSA free-noncomm"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

RDEPEND="dev-lang/perl
	 virtual/mailx
	 net-analyzer/rrdtool
	 >=net-misc/iputils-20071127-r2
	 sys-libs/gdbm
	 sys-libs/ncurses"

PATCHES=(
	"${FILESDIR}/${P}-ldflags-respect.patch"
	"${FILESDIR}/${P}-parallel-make.patch"
	"${FILESDIR}/${P}-non-interactive.patch"
	"${FILESDIR}/${P}-install-missing.patch"
	"${FILESDIR}/${P}-implicit-declarations.patch"
	"${FILESDIR}/${P}-conflicting-types.patch"
	"${FILESDIR}/${P}-code-ordering.patch"
	"${FILESDIR}/${P}-destdir-awareness.patch"
	"${FILESDIR}/${P}-trapmon-link-order.patch"
	"${FILESDIR}/${P}-nsmon-libresolv.patch"
	"${FILESDIR}/${P}-etherload-makefile-ordering.patch"
	"${FILESDIR}/${P}-linux3.patch"
)

src_prepare() {
	# Gentoo-specific non-interactive configure override
	cp "${FILESDIR}/${P}-r2-precache-config" "${S}/Config.cache" \
		|| die "Unable to precache configure script answers"
	echo "CFLAGS=\"${CFLAGS} -fPIC\"" >> "${S}/Config.cache"
	echo "CC=\"$(tc-getCC)\"" >> "${S}/Config.cache"
	echo "SRCDIR=\"${S}\"" >> "${S}/Config.cache"
	base_src_prepare
}

src_compile() {
	# Looks horrid due to missing linebreaks, suppress output
	ebegin "Running configure script (with precached settings)"
		./Configure &> /dev/null || die "Unable to configure"
	eend $?
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
}

pkg_preinst() {
	enewgroup snips
	enewuser snips -1 -1 /usr/snips snips
}

pkg_postinst() {
	ebegin "Fixing permissions"
	chown -R snips:snips "${ROOT}"usr/snips
	for x in data logs msgs rrddata run web device-help etc; do
		chmod -R g+w "${ROOT}usr/snips/${x}" \
			|| die "Unable to chmod ${x}"
	done
	chown root:snips "${ROOT}usr/snips/bin/multiping" || die "chown root failed"
	chown root:snips "${ROOT}usr/snips/bin/etherload" || die "chown root failed"
	chown root:snips "${ROOT}usr/snips/bin/trapmon" || die "chown root failed"
	chmod u+s "${ROOT}usr/snips/bin/multiping" || die "SetUID root failed"
	chmod u+s "${ROOT}usr/snips/bin/etherload" || die "SetUID root failed"
	chmod u+s "${ROOT}usr/snips/bin/trapmon" || die "SetUID root failed"
	eend $?
}