diff options
Diffstat (limited to 'recipes-extended/nagios/nagios-core_4.4.2.bb')
-rw-r--r-- | recipes-extended/nagios/nagios-core_4.4.2.bb | 151 |
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 @@ | |||
1 | require nagios-common.inc | ||
2 | |||
3 | DESCRIPTION = "A host/service/network monitoring and management system core files" | ||
4 | HOMEPAGE = "http://www.nagios.org" | ||
5 | SECTION = "console/network" | ||
6 | PRIORITY = "optional" | ||
7 | LICENSE = "GPLv2" | ||
8 | |||
9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae" | ||
10 | |||
11 | SRCNAME = "nagios" | ||
12 | |||
13 | SRC_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 | |||
23 | SRC_URI[md5sum] = "7a9736281d4e2ebe4f4569a782f733c5" | ||
24 | SRC_URI[sha256sum] = "3418923f326aa86dc8c84cfd0df788fa495a90d772f8071acf40fdbef0736853" | ||
25 | |||
26 | S = "${WORKDIR}/${SRCNAME}-${PV}" | ||
27 | |||
28 | inherit autotools-brokensep update-rc.d systemd | ||
29 | |||
30 | DEPENDS = "gd unzip-native" | ||
31 | |||
32 | RDEPENDS_${PN} += "\ | ||
33 | gd \ | ||
34 | libpng \ | ||
35 | fontconfig \ | ||
36 | apache2 \ | ||
37 | php \ | ||
38 | nagios-base \ | ||
39 | " | ||
40 | |||
41 | acpaths = "-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. | ||
45 | NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password" | ||
46 | NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin" | ||
47 | |||
48 | EXTRA_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 | ||
57 | EXTRA_OECONF += "ac_cv_path_STRIP=true" | ||
58 | |||
59 | # Prevent nagios from using dynamic libtool library | ||
60 | EXTRA_OECONF += "ac_cv_header_ltdl_h=no" | ||
61 | |||
62 | # Prevent nagios from suffering host contamination if host has /bin/perl | ||
63 | EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl" | ||
64 | |||
65 | # Set to "1" to allow nagios-core post-init to modify Apache configuration | ||
66 | NAGIOS_MODIFY_APACHE ??= "1" | ||
67 | |||
68 | do_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 | |||
75 | do_compile() { | ||
76 | oe_runmake all | ||
77 | } | ||
78 | |||
79 | do_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 | |||
115 | pkg_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 | |||
130 | PACKAGES += "${SRCNAME}-base ${PN}-setup" | ||
131 | |||
132 | FILES_${PN} += "${datadir} \ | ||
133 | ${NAGIOS_PLUGIN_DIR} \ | ||
134 | ${NAGIOS_CGIBIN_DIR} \ | ||
135 | " | ||
136 | |||
137 | FILES_${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug" | ||
138 | |||
139 | ALLOW_EMPTY_${SRCNAME}-base = "1" | ||
140 | ALLOW_EMPTY_${PN}-setup = "1" | ||
141 | |||
142 | SYSTEMD_PACKAGES = "${PN}" | ||
143 | SYSTEMD_SERVICE_${PN} = "nagios-core.service" | ||
144 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" | ||
145 | |||
146 | USERADD_PACKAGES += "${SRCNAME}-base" | ||
147 | GROUPADD_PARAM_${SRCNAME}-base = "-r ${NAGIOS_GROUP}" | ||
148 | USERADD_PARAM_${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" | ||
149 | |||
150 | INITSCRIPT_NAME = "nagios" | ||
151 | INITSCRIPT_PARAMS = "defaults" | ||