summaryrefslogtreecommitdiff
path: root/net/nagios-base/Makefile
blob: 33cdbedbbbda7a319972efb7c050885c8888873f (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
# $NetBSD: Makefile,v 1.15 2007/11/22 09:27:44 abs Exp $
#

DISTNAME=		nagios-2.5
PKGNAME=		${DISTNAME:S/-/-base-/}
PKGREVISION=		3
CATEGORIES=		net sysutils
MASTER_SITES=		${MASTER_SITE_SOURCEFORGE:=nagios/}

MAINTAINER=		pkgsrc-users@NetBSD.org
HOMEPAGE=		http://www.nagios.org/
COMMENT=		Network monitor

.include "../../mk/bsd.prefs.mk"
.include "../../net/nagios-base/Makefile.common"
.include "options.mk"

CONFIGURE_ARGS+=	--with-gd-lib=${LOCALBASE}/lib
CONFIGURE_ARGS+=	--with-gd-inc=${LOCALBASE}/include
CONFIGURE_ARGS+=	--enable-embedded-perl
CONFIGURE_ARGS+=	--with-perlcache

CONFIGURE_ARGS+=	--with-nagios-user=${NAGIOS_USER:Q}
CONFIGURE_ARGS+=	--with-nagios-group=${NAGIOS_GROUP:Q}
CONFIGURE_ARGS+=	--with-command-user=${ROOT_USER:Q}
CONFIGURE_ARGS+=	--with-command-grp=${ROOT_GROUP:Q}
CONFIGURE_ARGS+=	--with-init-dir=${PREFIX}/share/examples/rc.d
CONFIGURE_ARGS+=	--with-lockfile=/var/run/nagios/nagios.lock

USE_TOOLS+=		mail:run perl
CONFIGURE_ARGS+=	--with-mail=${TOOLS_PLATFORM.mail}

RCD_SCRIPTS+=		nagios

INSTALL_TARGET=		install install-config

BUILD_DEFS+=		VARBASE

PKG_GROUPS+=		${NAGIOS_GROUP}
PKG_GROUPS+=		${NAGIOSADM_GROUP}

PKG_USERS+=		${NAGIOS_USER}:${NAGIOS_GROUP}
PKG_USERS+=		${NAGIOSADM_USER}:${NAGIOSADM_GROUP}

PKG_GECOS.${NAGIOS_USER}=	Nagios Runtime User
PKG_GECOS.${NAGIOSADM_USER}=	Nagios Administrator
PKG_HOME.${NAGIOSADM_USER}=	${PKG_SYSCONFDIR}
PKG_SHELL.${NAGIOSADM_USER}=	${SH}

EGDIR=			${PREFIX}/share/examples/nagios
EGFILES=		cgi.cfg checkcommands.cfg contactgroups.cfg contacts.cfg
EGFILES+=		dependencies.cfg escalations.cfg hostgroups.cfg hosts.cfg
EGFILES+=		misccommands.cfg nagios.cfg resource.cfg services.cfg
EGFILES+=		timeperiods.cfg

.for files in ${EGFILES}
CONF_FILES+=		${EGDIR}/${files}-sample ${PKG_SYSCONFDIR}/${files}
.endfor
CONF_FILES+=		${EGDIR}/nagios.conf ${PKG_SYSCONFDIR}/nagios.conf

NAGIOS_DIRS=		log/nagios log/nagios/archives run/nagios run/nagios/rw
.for dir in ${NAGIOS_DIRS}
OWN_DIRS_PERMS+=	${VARBASE}/${dir} ${NAGIOS_USER} ${NAGIOS_GROUP} 0775
.endfor

SUBST_CLASSES+=		files
SUBST_STAGE.files=	post-build
SUBST_FILES.files=	nagios.conf.dist
SUBST_SED.files=	-e "s|@PREFIX@|${PREFIX}|g"
SUBST_MESSAGE.files=	Fixing configuration files.

pre-build:
	${CP} ${FILESDIR}/nagios.conf.dist ${WRKSRC}/nagios.conf.dist

post-install:
	${INSTALL_DATA} ${WRKSRC}/nagios.conf.dist ${EGDIR}/nagios.conf

.include "../../graphics/gd/buildlink3.mk"
.include "../../lang/perl5/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"