summaryrefslogtreecommitdiffstats
path: root/recipes-extended/nagios/nagios-core_4.4.2.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-extended/nagios/nagios-core_4.4.2.bb')
-rw-r--r--recipes-extended/nagios/nagios-core_4.4.2.bb151
1 files changed, 151 insertions, 0 deletions
diff --git a/recipes-extended/nagios/nagios-core_4.4.2.bb b/recipes-extended/nagios/nagios-core_4.4.2.bb
new file mode 100644
index 00000000..b2196eb3
--- /dev/null
+++ b/recipes-extended/nagios/nagios-core_4.4.2.bb
@@ -0,0 +1,151 @@
1require nagios-common.inc
2
3DESCRIPTION = "A host/service/network monitoring and management system core files"
4HOMEPAGE = "http://www.nagios.org"
5SECTION = "console/network"
6PRIORITY = "optional"
7LICENSE = "GPLv2"
8
9LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae"
10
11SRCNAME = "nagios"
12
13SRC_URI = "http://prdownloads.sourceforge.net/sourceforge/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \
14 file://eventhandlers_nagioscmd_path.patch \
15 file://0001-fix-autoheader-error.patch \
16 file://0001-fix-compile-error-of-missing-headers.patch \
17 file://0001-fix-segment-fault.patch \
18 file://volatiles \
19 file://nagios-core.service \
20 file://nagios-core-systemd-volatile.conf \
21 "
22
23SRC_URI[md5sum] = "7a9736281d4e2ebe4f4569a782f733c5"
24SRC_URI[sha256sum] = "3418923f326aa86dc8c84cfd0df788fa495a90d772f8071acf40fdbef0736853"
25
26S = "${WORKDIR}/${SRCNAME}-${PV}"
27
28inherit autotools-brokensep update-rc.d systemd
29
30DEPENDS = "gd unzip-native"
31
32RDEPENDS_${PN} += "\
33 gd \
34 libpng \
35 fontconfig \
36 apache2 \
37 php \
38 nagios-base \
39"
40
41acpaths = "-I ${S}/autoconf-macros"
42
43# Set default password for the hardcoded Nagios admin user "nagiosadmin".
44# If this variable is empty then will prompt user for password.
45NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password"
46NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin"
47
48EXTRA_OECONF += "--sbindir=${NAGIOS_CGIBIN_DIR} \
49 --datadir=${datadir}/nagios/htdocs \
50 --with-command-group=nagcmd \
51 --with-httpd-conf=${sysconfdir}/apache2/conf.d \
52 --with-lockfile=${localstatedir}/run/nagios/nagios.pid \
53 --with-init-dir=${sysconfdir}/init.d \
54"
55
56# Prevent nagios from stripping binaries, bitbake will take care of that
57EXTRA_OECONF += "ac_cv_path_STRIP=true"
58
59# Prevent nagios from using dynamic libtool library
60EXTRA_OECONF += "ac_cv_header_ltdl_h=no"
61
62# Prevent nagios from suffering host contamination if host has /bin/perl
63EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl"
64
65# Set to "1" to allow nagios-core post-init to modify Apache configuration
66NAGIOS_MODIFY_APACHE ??= "1"
67
68do_configure_prepend() {
69 # rename these macros to have .m4 suffix so that autoreconf could recognize them
70 for macro in `ls ${S}/autoconf-macros/ax_nagios_get_*`; do
71 mv $macro $macro.m4
72 done
73}
74
75do_compile() {
76 oe_runmake all
77}
78
79do_install() {
80 oe_runmake 'DESTDIR=${D}' install
81 oe_runmake 'DESTDIR=${D}' install-init
82 oe_runmake 'DESTDIR=${D}' install-config
83 oe_runmake 'DESTDIR=${D}' install-commandmode
84
85 install -d ${D}${sysconfdir}/apache2/conf.d
86 oe_runmake 'DESTDIR=${D}' install-webconf
87
88 install -d ${D}${NAGIOS_PLUGIN_CONF_DIR}
89
90 # There is no install target for the contributed eventhandlers so we
91 # just do it.
92 install -d ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers
93 for f in ${S}/contrib/eventhandlers/* ; do
94 if ! [ -f $f ] ; then
95 continue;
96 fi
97 install $f ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers/
98 done
99
100 echo "cfg_dir=${NAGIOS_PLUGIN_CONF_DIR}" >> ${D}${NAGIOS_CONF_DIR}/nagios.cfg
101
102 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
103 install -d ${D}${systemd_unitdir}/system
104 install -m 644 ${WORKDIR}/nagios-core.service ${D}${systemd_unitdir}/system/
105 # use our own service file
106 rm -f ${D}${systemd_unitdir}/system/nagios.service
107 install -d ${D}${sysconfdir}/tmpfiles.d
108 install -m 755 ${WORKDIR}/nagios-core-systemd-volatile.conf ${D}${sysconfdir}/tmpfiles.d/nagios-core-volatile.conf
109 else
110 install -d ${D}${sysconfdir}/default/volatiles
111 install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/99_nagios
112 fi
113}
114
115pkg_postinst_ontarget_${PN}-setup () {
116 # Set password for nagiosadmin user
117 if [ -z "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" ]; then
118 htpasswd -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin
119 else
120 htpasswd -b -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin \
121 "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}"
122 fi
123
124 # Apache2 might by default turn off CGI
125 if [ "${NAGIOS_MODIFY_APACHE}" == "1" ] && [ -f "${sysconfdir}/apache2/httpd.conf" ]; then
126 sed -e 's/^#LoadModule cgid_module/LoadModule cgid_module/g' -i ${sysconfdir}/apache2/httpd.conf
127 fi
128}
129
130PACKAGES += "${SRCNAME}-base ${PN}-setup"
131
132FILES_${PN} += "${datadir} \
133 ${NAGIOS_PLUGIN_DIR} \
134 ${NAGIOS_CGIBIN_DIR} \
135"
136
137FILES_${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug"
138
139ALLOW_EMPTY_${SRCNAME}-base = "1"
140ALLOW_EMPTY_${PN}-setup = "1"
141
142SYSTEMD_PACKAGES = "${PN}"
143SYSTEMD_SERVICE_${PN} = "nagios-core.service"
144SYSTEMD_AUTO_ENABLE_${PN} = "enable"
145
146USERADD_PACKAGES += "${SRCNAME}-base"
147GROUPADD_PARAM_${SRCNAME}-base = "-r ${NAGIOS_GROUP}"
148USERADD_PARAM_${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}"
149
150INITSCRIPT_NAME = "nagios"
151INITSCRIPT_PARAMS = "defaults"