diff options
Diffstat (limited to 'recipes-extended/nagios/nagios-core_git.bb')
-rw-r--r-- | recipes-extended/nagios/nagios-core_git.bb | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/recipes-extended/nagios/nagios-core_git.bb b/recipes-extended/nagios/nagios-core_git.bb new file mode 100644 index 00000000..5ffb4e17 --- /dev/null +++ b/recipes-extended/nagios/nagios-core_git.bb | |||
@@ -0,0 +1,168 @@ | |||
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 = "GPL-2.0-only" | ||
8 | |||
9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae" | ||
10 | |||
11 | SRCNAME = "nagios" | ||
12 | |||
13 | SRCREV = "2706fa7a451afe48bd4dc240d72d23fdcec0d9ef" | ||
14 | |||
15 | SRC_URI = "git://github.com/NagiosEnterprises/nagioscore.git;protocol=https;branch=master \ | ||
16 | file://eventhandlers_nagioscmd_path.patch \ | ||
17 | file://0001-fix-compile-error-of-missing-headers.patch \ | ||
18 | file://0001-fix-segment-fault.patch \ | ||
19 | file://volatiles \ | ||
20 | file://nagios-core.service \ | ||
21 | file://nagios-core-systemd-volatile.conf \ | ||
22 | " | ||
23 | |||
24 | PV = "4.5.9+git" | ||
25 | |||
26 | S = "${WORKDIR}/git" | ||
27 | |||
28 | inherit autotools-brokensep update-rc.d systemd update-alternatives pkgconfig | ||
29 | |||
30 | DEPENDS = "gd unzip-native openssl" | ||
31 | |||
32 | RDEPENDS:${PN} += "\ | ||
33 | gd \ | ||
34 | libpng \ | ||
35 | fontconfig \ | ||
36 | apache2 \ | ||
37 | php-cli \ | ||
38 | nagios-base \ | ||
39 | " | ||
40 | |||
41 | SKIP_RECIPE[nagios-core] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'webserver', '', 'Depends on apache2 from meta-webserver which is not included', d)}" | ||
42 | |||
43 | acpaths = "-I ${S}/autoconf-macros" | ||
44 | EXTRA_AUTORECONF += "-I ${S}/m4 -I ${S}/autoconf-macros" | ||
45 | |||
46 | # Set default password for the hardcoded Nagios admin user "nagiosadmin". | ||
47 | # If this variable is empty then will prompt user for password. | ||
48 | NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password" | ||
49 | NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin" | ||
50 | |||
51 | EXTRA_OECONF += "--sbindir=${NAGIOS_CGIBIN_DIR} \ | ||
52 | --datadir=${datadir}/nagios/htdocs \ | ||
53 | --with-command-group=nagcmd \ | ||
54 | --with-httpd-conf=${sysconfdir}/apache2/conf.d \ | ||
55 | --with-lockfile=${localstatedir}/run/nagios/nagios.pid \ | ||
56 | --with-initdir=${sysconfdir}/init.d \ | ||
57 | --with-init-type=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'sysv', d)} \ | ||
58 | --with-inetd-type=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'inetd', d)} \ | ||
59 | " | ||
60 | |||
61 | # Prevent nagios from stripping binaries, bitbake will take care of that | ||
62 | EXTRA_OECONF += "ac_cv_path_STRIP=true" | ||
63 | |||
64 | # Prevent nagios from using dynamic libtool library | ||
65 | EXTRA_OECONF += "ac_cv_header_ltdl_h=no" | ||
66 | |||
67 | # Prevent nagios from suffering host contamination if host has /bin/perl | ||
68 | EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl" | ||
69 | |||
70 | # Fix build failure for gcc-10 | ||
71 | CFLAGS:append = " -fcommon" | ||
72 | |||
73 | # Set to "1" to allow nagios-core post-init to modify Apache configuration | ||
74 | NAGIOS_MODIFY_APACHE ??= "1" | ||
75 | |||
76 | do_configure:prepend() { | ||
77 | # rename these macros to have .m4 suffix so that autoreconf could recognize them | ||
78 | for macro in `ls ${S}/autoconf-macros/ax_nagios_get_*`; do | ||
79 | mv $macro $macro.m4 | ||
80 | done | ||
81 | } | ||
82 | |||
83 | do_compile() { | ||
84 | oe_runmake all | ||
85 | } | ||
86 | |||
87 | do_install() { | ||
88 | oe_runmake 'DESTDIR=${D}' install-unstripped | ||
89 | oe_runmake 'DESTDIR=${D}' install-init | ||
90 | oe_runmake 'DESTDIR=${D}' install-config | ||
91 | oe_runmake 'DESTDIR=${D}' install-commandmode | ||
92 | |||
93 | install -d ${D}${sysconfdir}/apache2/conf.d | ||
94 | oe_runmake 'DESTDIR=${D}' install-webconf | ||
95 | |||
96 | install -d ${D}${NAGIOS_PLUGIN_CONF_DIR} | ||
97 | |||
98 | # There is no install target for the contributed eventhandlers so we | ||
99 | # just do it. | ||
100 | install -d ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers | ||
101 | for f in ${S}/contrib/eventhandlers/* ; do | ||
102 | if ! [ -f $f ] ; then | ||
103 | continue; | ||
104 | fi | ||
105 | install $f ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers/ | ||
106 | done | ||
107 | |||
108 | echo "cfg_dir=${NAGIOS_PLUGIN_CONF_DIR}" >> ${D}${NAGIOS_CONF_DIR}/nagios.cfg | ||
109 | |||
110 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
111 | install -d ${D}${systemd_unitdir}/system | ||
112 | install -m 644 ${UNPACKDIR}/nagios-core.service ${D}${systemd_unitdir}/system/ | ||
113 | # use our own service file | ||
114 | nagios_default_service=$(find ${D} -name 'nagios.service') | ||
115 | if [ -n "$nagios_default_service" ]; then | ||
116 | rm -f $nagios_default_service | ||
117 | fi | ||
118 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
119 | install -m 755 ${UNPACKDIR}/nagios-core-systemd-volatile.conf ${D}${sysconfdir}/tmpfiles.d/nagios-core-volatile.conf | ||
120 | else | ||
121 | install -d ${D}${sysconfdir}/default/volatiles | ||
122 | install -m 0644 ${UNPACKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/99_nagios | ||
123 | fi | ||
124 | } | ||
125 | |||
126 | pkg_postinst_ontarget:${PN}-setup () { | ||
127 | # Set password for nagiosadmin user | ||
128 | if [ -z "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" ]; then | ||
129 | htpasswd -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin | ||
130 | else | ||
131 | htpasswd -b -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin \ | ||
132 | "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" | ||
133 | fi | ||
134 | |||
135 | # Apache2 might by default turn off CGI | ||
136 | if [ "${NAGIOS_MODIFY_APACHE}" == "1" ] && [ -f "${sysconfdir}/apache2/httpd.conf" ]; then | ||
137 | sed -e 's/^#LoadModule cgid_module/LoadModule cgid_module/g' -i ${sysconfdir}/apache2/httpd.conf | ||
138 | fi | ||
139 | } | ||
140 | |||
141 | PACKAGES += "${SRCNAME}-base ${PN}-setup" | ||
142 | |||
143 | FILES:${PN} += "${datadir} \ | ||
144 | ${NAGIOS_PLUGIN_DIR} \ | ||
145 | ${NAGIOS_CGIBIN_DIR} \ | ||
146 | " | ||
147 | |||
148 | FILES:${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug" | ||
149 | |||
150 | ALLOW_EMPTY:${SRCNAME}-base = "1" | ||
151 | ALLOW_EMPTY:${PN}-setup = "1" | ||
152 | |||
153 | SYSTEMD_PACKAGES = "${PN}" | ||
154 | SYSTEMD_SERVICE:${PN} = "nagios-core.service" | ||
155 | SYSTEMD_AUTO_ENABLE:${PN} = "enable" | ||
156 | |||
157 | USERADD_PACKAGES += "${SRCNAME}-base" | ||
158 | GROUPADD_PARAM:${SRCNAME}-base = "-r ${NAGIOS_GROUP}" | ||
159 | USERADD_PARAM:${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" | ||
160 | |||
161 | INITSCRIPT_NAME = "nagios" | ||
162 | INITSCRIPT_PARAMS = "defaults" | ||
163 | |||
164 | CVE_PRODUCT = "nagios_core" | ||
165 | |||
166 | ALTERNATIVE_PRIORITY_${PN} = '20' | ||
167 | ALTERNATIVE:${PN} = "nagios" | ||
168 | ALTERNATIVE_LINK_NAME[nagios] = "${localstatedir}/nagios" | ||