diff options
| author | Chen Qi <Qi.Chen@windriver.com> | 2018-09-06 09:38:55 +0800 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-09-06 12:45:17 -0400 |
| commit | 7929c468f0faeb2aeeca6476057d7dbf7c465cd0 (patch) | |
| tree | 6c66c983b5f721584943340e8abbcde376c1fd0a /recipes-extended | |
| parent | 09b67e49bf871fd1988d1d567626a4382ebc2fb0 (diff) | |
| download | meta-virtualization-7929c468f0faeb2aeeca6476057d7dbf7c465cd0.tar.gz | |
nagios-core: add recipe with latest stable version 4.4.2
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-extended')
9 files changed, 464 insertions, 0 deletions
diff --git a/recipes-extended/nagios/nagios-common.inc b/recipes-extended/nagios/nagios-common.inc new file mode 100644 index 00000000..c173041c --- /dev/null +++ b/recipes-extended/nagios/nagios-common.inc | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | NAGIOS_CONF_DIR = "${sysconfdir}/nagios" | ||
| 2 | NAGIOS_PLUGIN_DIR = "${libdir}/nagios/plugins" | ||
| 3 | NAGIOS_PLUGIN_CONF_DIR = "${NAGIOS_CONF_DIR}/plugins" | ||
| 4 | NAGIOS_STATE_DIR = "${localstatedir}/nagios" | ||
| 5 | |||
| 6 | NAGIOS_USER = "nagios" | ||
| 7 | NAGIOS_GROUP = "nagios" | ||
| 8 | |||
| 9 | EXTRA_OECONF += "--sysconfdir=${NAGIOS_CONF_DIR} \ | ||
| 10 | --libexecdir=${NAGIOS_PLUGIN_DIR} \ | ||
| 11 | --localstatedir=${NAGIOS_STATE_DIR} \ | ||
| 12 | " | ||
| 13 | |||
| 14 | FILES_${PN}-dbg += "${NAGIOS_PLUGIN_DIR}/.debug" | ||
| 15 | |||
| 16 | DEPENDS = "nagios-core" | ||
| 17 | |||
| 18 | COMPATIBLE_HOST_aarch64 = "null" | ||
| 19 | |||
| 20 | inherit useradd | ||
| 21 | |||
| 22 | USERADD_PACKAGES = "${PN}" | ||
| 23 | GROUPADD_PARAM_${PN} = "-r ${NAGIOS_GROUP}; -r nagcmd" | ||
| 24 | USERADD_PARAM_${PN} = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" | ||
| 25 | |||
| 26 | FILESYSTEM_PERMS_TABLES_append = " files/fs-perms-nagios.txt" | ||
diff --git a/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch b/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch new file mode 100644 index 00000000..014ed1d8 --- /dev/null +++ b/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | From 3c51d942f6da08045351ce61cc7f426fa0855489 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
| 3 | Date: Fri, 31 Aug 2018 10:51:36 +0800 | ||
| 4 | Subject: [PATCH] fix autoheader error | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 9 | --- | ||
| 10 | configure.ac | 12 ++++++------ | ||
| 11 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/configure.ac b/configure.ac | ||
| 14 | index 17e436d..16b3e71 100644 | ||
| 15 | --- a/configure.ac | ||
| 16 | +++ b/configure.ac | ||
| 17 | @@ -388,7 +388,7 @@ AC_ARG_WITH(iobroker, | ||
| 18 | case $IOBROKER_METHOD in | ||
| 19 | epoll*) | ||
| 20 | if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then | ||
| 21 | - AC_DEFINE([IOBROKER_USES_EPOLL]) | ||
| 22 | + AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll]) | ||
| 23 | else | ||
| 24 | echo "\"epoll\" is not available as an iobroker method." | ||
| 25 | echo "Please use one of the other options." | ||
| 26 | @@ -397,7 +397,7 @@ epoll*) | ||
| 27 | ;; | ||
| 28 | poll*) | ||
| 29 | if test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then | ||
| 30 | - AC_DEFINE([IOBROKER_USES_POLL]) | ||
| 31 | + AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll]) | ||
| 32 | else | ||
| 33 | echo "\"poll\" is not available as an iobroker method." | ||
| 34 | echo "Please use one of the other options." | ||
| 35 | @@ -406,7 +406,7 @@ poll*) | ||
| 36 | ;; | ||
| 37 | select*) | ||
| 38 | if test "x$ac_cv_header_sys_select_h" = "xyes"; then | ||
| 39 | - AC_DEFINE([IOBROKER_USES_SELECT]) | ||
| 40 | + AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select]) | ||
| 41 | else | ||
| 42 | echo "\"select\" is not available as an iobroker method." | ||
| 43 | echo "Please use one of the other options." | ||
| 44 | @@ -415,13 +415,13 @@ select*) | ||
| 45 | ;; | ||
| 46 | none*) | ||
| 47 | if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then | ||
| 48 | - AC_DEFINE([IOBROKER_USES_EPOLL]) | ||
| 49 | + AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll]) | ||
| 50 | IOBROKER_METHOD="epoll" | ||
| 51 | elif test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then | ||
| 52 | - AC_DEFINE([IOBROKER_USES_POLL]) | ||
| 53 | + AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll]) | ||
| 54 | IOBROKER_METHOD="poll" | ||
| 55 | elif test "x$ac_cv_header_sys_select_h" = "xyes"; then | ||
| 56 | - AC_DEFINE([IOBROKER_USES_SELECT]) | ||
| 57 | + AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select]) | ||
| 58 | IOBROKER_METHOD="select" | ||
| 59 | else | ||
| 60 | echo "There are no available options for iobroker polling" | ||
| 61 | -- | ||
| 62 | 2.7.4 | ||
| 63 | |||
diff --git a/recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch b/recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch new file mode 100644 index 00000000..7f4cfbd7 --- /dev/null +++ b/recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | From a5e12350cb25b2f9289c0d27e26afc337652d42e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
| 3 | Date: Fri, 31 Aug 2018 13:33:31 +0800 | ||
| 4 | Subject: [PATCH] fix compile error of missing headers | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 9 | --- | ||
| 10 | cgi/getcgi.c | 3 ++- | ||
| 11 | include/shared.h | 31 +++++++++++++++++++++++++++++++ | ||
| 12 | 2 files changed, 33 insertions(+), 1 deletion(-) | ||
| 13 | |||
| 14 | diff --git a/cgi/getcgi.c b/cgi/getcgi.c | ||
| 15 | index 37b479f..1f83e11 100644 | ||
| 16 | --- a/cgi/getcgi.c | ||
| 17 | +++ b/cgi/getcgi.c | ||
| 18 | @@ -7,10 +7,11 @@ | ||
| 19 | |||
| 20 | #include "../include/config.h" | ||
| 21 | #include "../include/getcgi.h" | ||
| 22 | +#include "../include/shared.h" | ||
| 23 | + | ||
| 24 | #include <stdio.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | |||
| 27 | - | ||
| 28 | #undef PARANOID_CGI_INPUT | ||
| 29 | |||
| 30 | |||
| 31 | diff --git a/include/shared.h b/include/shared.h | ||
| 32 | index 84836c7..1dfa0c7 100644 | ||
| 33 | --- a/include/shared.h | ||
| 34 | +++ b/include/shared.h | ||
| 35 | @@ -1,6 +1,37 @@ | ||
| 36 | #ifndef NAGIOS_SHARED_H_INCLUDED | ||
| 37 | #define NAGIOS_SHARED_H_INCLUDED | ||
| 38 | |||
| 39 | +#include <stdio.h> | ||
| 40 | +#include <sys/types.h> | ||
| 41 | +#include <sys/stat.h> | ||
| 42 | +#include <sys/socket.h> | ||
| 43 | +#include <sys/mman.h> | ||
| 44 | +#include <stdlib.h> | ||
| 45 | +#include <stddef.h> | ||
| 46 | +#include <stdlib.h> | ||
| 47 | +#include <memory.h> | ||
| 48 | +#include <string.h> | ||
| 49 | +#include <strings.h> | ||
| 50 | +#include <inttypes.h> | ||
| 51 | +#include <stdint.h> | ||
| 52 | +#include <unistd.h> | ||
| 53 | +#include <dirent.h> | ||
| 54 | +#include <math.h> | ||
| 55 | +#include <fcntl.h> | ||
| 56 | +#include <regex.h> | ||
| 57 | +#include <ctype.h> | ||
| 58 | +#include <sys/prctl.h> | ||
| 59 | +#include <stdarg.h> | ||
| 60 | +#include <dlfcn.h> | ||
| 61 | +#include <getopt.h> | ||
| 62 | +#include <syslog.h> | ||
| 63 | +#include <pwd.h> | ||
| 64 | +#include <grp.h> | ||
| 65 | +#include <netdb.h> | ||
| 66 | +#include <wchar.h> | ||
| 67 | +#include <locale.h> | ||
| 68 | +#include <limits.h> | ||
| 69 | + | ||
| 70 | #include <time.h> | ||
| 71 | #include "lib/libnagios.h" | ||
| 72 | |||
| 73 | -- | ||
| 74 | 2.7.4 | ||
| 75 | |||
diff --git a/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch b/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch new file mode 100644 index 00000000..1ea8da9c --- /dev/null +++ b/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | From 65e4539c6eca215d8d79ef8acc5c8842b886752a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
| 3 | Date: Mon, 3 Sep 2018 13:15:29 +0800 | ||
| 4 | Subject: [PATCH] fix segment fault | ||
| 5 | |||
| 6 | When using strdup(dirname(cfgfile)) directly, we will have segment | ||
| 7 | fault. This happens at least for glibc 2.28. So we do it step by | ||
| 8 | step, and this would avoid the segment fault. | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 13 | --- | ||
| 14 | include/shared.h | 1 + | ||
| 15 | xdata/xodtemplate.c | 4 +++- | ||
| 16 | 2 files changed, 4 insertions(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/include/shared.h b/include/shared.h | ||
| 19 | index 1dfa0c7..0188c7d 100644 | ||
| 20 | --- a/include/shared.h | ||
| 21 | +++ b/include/shared.h | ||
| 22 | @@ -31,6 +31,7 @@ | ||
| 23 | #include <wchar.h> | ||
| 24 | #include <locale.h> | ||
| 25 | #include <limits.h> | ||
| 26 | +#include <libgen.h> | ||
| 27 | |||
| 28 | #include <time.h> | ||
| 29 | #include "lib/libnagios.h" | ||
| 30 | diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c | ||
| 31 | index 33d51f4..da32e69 100644 | ||
| 32 | --- a/xdata/xodtemplate.c | ||
| 33 | +++ b/xdata/xodtemplate.c | ||
| 34 | @@ -187,6 +187,7 @@ static void xodtemplate_free_template_skiplists(void) { | ||
| 35 | int xodtemplate_read_config_data(const char *main_config_file, int options) { | ||
| 36 | #ifdef NSCORE | ||
| 37 | char *cfgfile = NULL; | ||
| 38 | + char *cfgfile_dir = NULL; | ||
| 39 | char *config_base_dir = NULL; | ||
| 40 | char *input = NULL; | ||
| 41 | char *var = NULL; | ||
| 42 | @@ -261,7 +262,8 @@ int xodtemplate_read_config_data(const char *main_config_file, int options) { | ||
| 43 | printf("Unable to allocate memory!\n"); | ||
| 44 | return ERROR; | ||
| 45 | } | ||
| 46 | - config_base_dir = (char *)strdup(dirname(cfgfile)); | ||
| 47 | + cfgfile_dir = dirname(cfgfile); | ||
| 48 | + config_base_dir = (char *)strdup(cfgfile_dir); | ||
| 49 | my_free(cfgfile); | ||
| 50 | |||
| 51 | /* open the main config file for reading (we need to find all the config files to read) */ | ||
| 52 | -- | ||
| 53 | 2.7.4 | ||
| 54 | |||
diff --git a/recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch b/recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch new file mode 100644 index 00000000..c767162c --- /dev/null +++ b/recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | change eventhandlers nagioscmd path | ||
| 2 | |||
| 3 | Modify nagios.cmd path to the right location | ||
| 4 | at "/var/nagios/rw/nagios.cmd" | ||
| 5 | |||
| 6 | Signed-off-by: Rickard Engberg <rickard.engberg@windriver.com> | ||
| 7 | Signed-off-by: Vu Tran <vu.tran@windriver.com> | ||
| 8 | |||
| 9 | diff --git a/contrib/eventhandlers/disable_active_service_checks b/contrib/eventhandlers/disable_active_service_checks | ||
| 10 | index c01f2be..2c2880b 100755 | ||
| 11 | --- a/contrib/eventhandlers/disable_active_service_checks | ||
| 12 | +++ b/contrib/eventhandlers/disable_active_service_checks | ||
| 13 | @@ -16,7 +16,7 @@ | ||
| 14 | |||
| 15 | printfcmd="/usr/bin/printf" | ||
| 16 | |||
| 17 | -CommandFile="/usr/local/nagios/var/rw/nagios.cmd" | ||
| 18 | +CommandFile="/var/nagios/rw/nagios.cmd" | ||
| 19 | |||
| 20 | # get the current date/time in seconds since UNIX epoch | ||
| 21 | datetime=`date +%s` | ||
| 22 | diff --git a/contrib/eventhandlers/disable_notifications b/contrib/eventhandlers/disable_notifications | ||
| 23 | index a92bb7a..b2c9c06 100755 | ||
| 24 | --- a/contrib/eventhandlers/disable_notifications | ||
| 25 | +++ b/contrib/eventhandlers/disable_notifications | ||
| 26 | @@ -14,7 +14,7 @@ | ||
| 27 | |||
| 28 | printfcmd="/usr/bin/printf" | ||
| 29 | |||
| 30 | -CommandFile="/usr/local/nagios/var/rw/nagios.cmd" | ||
| 31 | +CommandFile="/var/nagios/rw/nagios.cmd" | ||
| 32 | |||
| 33 | # get the current date/time in seconds since UNIX epoch | ||
| 34 | datetime=`date +%s` | ||
| 35 | diff --git a/contrib/eventhandlers/enable_active_service_checks b/contrib/eventhandlers/enable_active_service_checks | ||
| 36 | index 423c8d9..631fa00 100755 | ||
| 37 | --- a/contrib/eventhandlers/enable_active_service_checks | ||
| 38 | +++ b/contrib/eventhandlers/enable_active_service_checks | ||
| 39 | @@ -16,7 +16,7 @@ | ||
| 40 | |||
| 41 | printfcmd="/usr/bin/printf" | ||
| 42 | |||
| 43 | -CommandFile="/usr/local/nagios/var/rw/nagios.cmd" | ||
| 44 | +CommandFile="/var/nagios/rw/nagios.cmd" | ||
| 45 | |||
| 46 | # get the current date/time in seconds since UNIX epoch | ||
| 47 | datetime=`date +%s` | ||
| 48 | diff --git a/contrib/eventhandlers/enable_notifications b/contrib/eventhandlers/enable_notifications | ||
| 49 | index 0d3f13d..2cc0b47 100755 | ||
| 50 | --- a/contrib/eventhandlers/enable_notifications | ||
| 51 | +++ b/contrib/eventhandlers/enable_notifications | ||
| 52 | @@ -14,7 +14,7 @@ | ||
| 53 | |||
| 54 | printfcmd="/usr/bin/printf" | ||
| 55 | |||
| 56 | -CommandFile="/usr/local/nagios/var/rw/nagios.cmd" | ||
| 57 | +CommandFile="/var/nagios/rw/nagios.cmd" | ||
| 58 | |||
| 59 | # get the current date/time in seconds since UNIX epoch | ||
| 60 | datetime=`date +%s` | ||
| 61 | diff --git a/contrib/eventhandlers/submit_check_result b/contrib/eventhandlers/submit_check_result | ||
| 62 | index 5d89f31..790a988 100755 | ||
| 63 | --- a/contrib/eventhandlers/submit_check_result | ||
| 64 | +++ b/contrib/eventhandlers/submit_check_result | ||
| 65 | @@ -24,7 +24,7 @@ | ||
| 66 | |||
| 67 | echocmd="/bin/echo" | ||
| 68 | |||
| 69 | -CommandFile="/usr/local/nagios/var/rw/nagios.cmd" | ||
| 70 | +CommandFile="/var/nagios/rw/nagios.cmd" | ||
| 71 | |||
| 72 | # get the current date/time in seconds since UNIX epoch | ||
| 73 | datetime=`date +%s` | ||
diff --git a/recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf b/recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf new file mode 100644 index 00000000..134fb854 --- /dev/null +++ b/recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | d /var/nagios 0755 nagios nagios - | ||
| 2 | d /var/run/nagios 0755 nagios nagios - | ||
diff --git a/recipes-extended/nagios/nagios-core/nagios-core.service b/recipes-extended/nagios/nagios-core/nagios-core.service new file mode 100644 index 00000000..61fda3f7 --- /dev/null +++ b/recipes-extended/nagios/nagios-core/nagios-core.service | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Nagios core | ||
| 3 | After=network.target local-fs.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | Type=forking | ||
| 7 | User=nagios | ||
| 8 | Group=nagios | ||
| 9 | PIDFile=/var/run/nagios/nagios.pid | ||
| 10 | # Verify Nagios config before start as upstream suggested | ||
| 11 | ExecStartPre=/usr/bin/nagios -v /etc/nagios/nagios.cfg | ||
| 12 | ExecStart=/usr/bin/nagios -d /etc/nagios/nagios.cfg | ||
| 13 | ExecStop=/bin/kill -TERM ${MAINPID} | ||
| 14 | ExecStopPost=/bin/rm -f /var/spool/nagios/cmd/nagios.cmd | ||
| 15 | ExecReload=/bin/kill -HUP ${MAINPID} | ||
| 16 | |||
| 17 | [Install] | ||
| 18 | WantedBy=multi-user.target | ||
diff --git a/recipes-extended/nagios/nagios-core/volatiles b/recipes-extended/nagios/nagios-core/volatiles new file mode 100644 index 00000000..e9bb7680 --- /dev/null +++ b/recipes-extended/nagios/nagios-core/volatiles | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | d nagios nagios 0755 /var/nagios none | ||
| 2 | d nagios nagios 0755 /var/run/nagios none | ||
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" | ||
