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

inherit eutils 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"

src_unpack() {
	unpack ${A}
	cd "${S}"
	# Gentoo-specific non-interactive configure override
	cp "${FILESDIR}/${PF}-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"
	epatch "${FILESDIR}/${P}-non-interactive.patch"
	# Applied to upstream CVS
	epatch "${FILESDIR}/${P}-install-missing.patch"
	epatch "${FILESDIR}/${P}-implicit-declarations.patch"
	epatch "${FILESDIR}/${P}-conflicting-types.patch"
	epatch "${FILESDIR}/${P}-code-ordering.patch"
	epatch "${FILESDIR}/${P}-destdir-awareness.patch"
	epatch "${FILESDIR}/${P}-link-correct-snmp-lib.patch"
}

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 $?
}