From b24f0a31529ae11d93c63c2b51719ceffb855135 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 25 Mar 2025 16:24:25 +0000 Subject: nagios-core to git (and update) Move nagios-core away from the sourceforge and tarball releases to a git based fetch and build. We update the configuration to adapt to the newer nagios core, but otherwise, this is largely unchanged. Signed-off-by: Bruce Ashfield --- .../nagios-core/0001-fix-autoheader-error.patch | 63 -------- recipes-extended/nagios/nagios-core_4.4.6.bb | 162 -------------------- recipes-extended/nagios/nagios-core_git.bb | 168 +++++++++++++++++++++ 3 files changed, 168 insertions(+), 225 deletions(-) delete mode 100644 recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch delete mode 100644 recipes-extended/nagios/nagios-core_4.4.6.bb create mode 100644 recipes-extended/nagios/nagios-core_git.bb diff --git a/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch b/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch deleted file mode 100644 index 014ed1d8..00000000 --- a/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 3c51d942f6da08045351ce61cc7f426fa0855489 Mon Sep 17 00:00:00 2001 -From: Chen Qi -Date: Fri, 31 Aug 2018 10:51:36 +0800 -Subject: [PATCH] fix autoheader error - -Upstream-Status: Pending - -Signed-off-by: Chen Qi ---- - configure.ac | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 17e436d..16b3e71 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -388,7 +388,7 @@ AC_ARG_WITH(iobroker, - case $IOBROKER_METHOD in - epoll*) - if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then -- AC_DEFINE([IOBROKER_USES_EPOLL]) -+ AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll]) - else - echo "\"epoll\" is not available as an iobroker method." - echo "Please use one of the other options." -@@ -397,7 +397,7 @@ epoll*) - ;; - poll*) - if test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then -- AC_DEFINE([IOBROKER_USES_POLL]) -+ AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll]) - else - echo "\"poll\" is not available as an iobroker method." - echo "Please use one of the other options." -@@ -406,7 +406,7 @@ poll*) - ;; - select*) - if test "x$ac_cv_header_sys_select_h" = "xyes"; then -- AC_DEFINE([IOBROKER_USES_SELECT]) -+ AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select]) - else - echo "\"select\" is not available as an iobroker method." - echo "Please use one of the other options." -@@ -415,13 +415,13 @@ select*) - ;; - none*) - if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then -- AC_DEFINE([IOBROKER_USES_EPOLL]) -+ AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll]) - IOBROKER_METHOD="epoll" - elif test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then -- AC_DEFINE([IOBROKER_USES_POLL]) -+ AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll]) - IOBROKER_METHOD="poll" - elif test "x$ac_cv_header_sys_select_h" = "xyes"; then -- AC_DEFINE([IOBROKER_USES_SELECT]) -+ AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select]) - IOBROKER_METHOD="select" - else - echo "There are no available options for iobroker polling" --- -2.7.4 - diff --git a/recipes-extended/nagios/nagios-core_4.4.6.bb b/recipes-extended/nagios/nagios-core_4.4.6.bb deleted file mode 100644 index 7ec930cd..00000000 --- a/recipes-extended/nagios/nagios-core_4.4.6.bb +++ /dev/null @@ -1,162 +0,0 @@ -require nagios-common.inc - -DESCRIPTION = "A host/service/network monitoring and management system core files" -HOMEPAGE = "http://www.nagios.org" -SECTION = "console/network" -PRIORITY = "optional" -LICENSE = "GPL-2.0-only" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae" - -SRCNAME = "nagios" - -SRC_URI = "http://prdownloads.sourceforge.net/sourceforge/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \ - file://eventhandlers_nagioscmd_path.patch \ - file://0001-fix-autoheader-error.patch \ - file://0001-fix-compile-error-of-missing-headers.patch \ - file://0001-fix-segment-fault.patch \ - file://volatiles \ - file://nagios-core.service \ - file://nagios-core-systemd-volatile.conf \ - " - -SRC_URI[md5sum] = "ba849e9487e13859381eb117127bfee2" -SRC_URI[sha256sum] = "ab0d5a52caf01e6f4dcd84252c4eb5df5a24f90bb7f951f03875eef54f5ab0f4" - -S = "${WORKDIR}/${SRCNAME}-${PV}" - -inherit autotools-brokensep update-rc.d systemd update-alternatives - -DEPENDS = "gd unzip-native" - -RDEPENDS:${PN} += "\ - gd \ - libpng \ - fontconfig \ - apache2 \ - php-cli \ - nagios-base \ -" - -SKIP_RECIPE[nagios-core] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'webserver', '', 'Depends on apache2 from meta-webserver which is not included', d)}" - -acpaths = "-I ${S}/autoconf-macros" - -# Set default password for the hardcoded Nagios admin user "nagiosadmin". -# If this variable is empty then will prompt user for password. -NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password" -NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin" - -EXTRA_OECONF += "--sbindir=${NAGIOS_CGIBIN_DIR} \ - --datadir=${datadir}/nagios/htdocs \ - --with-command-group=nagcmd \ - --with-httpd-conf=${sysconfdir}/apache2/conf.d \ - --with-lockfile=${localstatedir}/run/nagios/nagios.pid \ - --with-init-dir=${sysconfdir}/init.d \ -" - -# Prevent nagios from stripping binaries, bitbake will take care of that -EXTRA_OECONF += "ac_cv_path_STRIP=true" - -# Prevent nagios from using dynamic libtool library -EXTRA_OECONF += "ac_cv_header_ltdl_h=no" - -# Prevent nagios from suffering host contamination if host has /bin/perl -EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl" - -# Fix build failure for gcc-10 -CFLAGS:append = " -fcommon" - -# Set to "1" to allow nagios-core post-init to modify Apache configuration -NAGIOS_MODIFY_APACHE ??= "1" - -do_configure:prepend() { - # rename these macros to have .m4 suffix so that autoreconf could recognize them - for macro in `ls ${S}/autoconf-macros/ax_nagios_get_*`; do - mv $macro $macro.m4 - done -} - -do_compile() { - oe_runmake all -} - -do_install() { - oe_runmake 'DESTDIR=${D}' install-unstripped - oe_runmake 'DESTDIR=${D}' install-init - oe_runmake 'DESTDIR=${D}' install-config - oe_runmake 'DESTDIR=${D}' install-commandmode - - install -d ${D}${sysconfdir}/apache2/conf.d - oe_runmake 'DESTDIR=${D}' install-webconf - - install -d ${D}${NAGIOS_PLUGIN_CONF_DIR} - - # There is no install target for the contributed eventhandlers so we - # just do it. - install -d ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers - for f in ${S}/contrib/eventhandlers/* ; do - if ! [ -f $f ] ; then - continue; - fi - install $f ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers/ - done - - echo "cfg_dir=${NAGIOS_PLUGIN_CONF_DIR}" >> ${D}${NAGIOS_CONF_DIR}/nagios.cfg - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${systemd_unitdir}/system - install -m 644 ${UNPACKDIR}/nagios-core.service ${D}${systemd_unitdir}/system/ - # use our own service file - rm -f ${D}${systemd_unitdir}/system/nagios.service - install -d ${D}${sysconfdir}/tmpfiles.d - install -m 755 ${UNPACKDIR}/nagios-core-systemd-volatile.conf ${D}${sysconfdir}/tmpfiles.d/nagios-core-volatile.conf - else - install -d ${D}${sysconfdir}/default/volatiles - install -m 0644 ${UNPACKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/99_nagios - fi -} - -pkg_postinst_ontarget:${PN}-setup () { - # Set password for nagiosadmin user - if [ -z "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" ]; then - htpasswd -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin - else - htpasswd -b -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin \ - "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" - fi - - # Apache2 might by default turn off CGI - if [ "${NAGIOS_MODIFY_APACHE}" == "1" ] && [ -f "${sysconfdir}/apache2/httpd.conf" ]; then - sed -e 's/^#LoadModule cgid_module/LoadModule cgid_module/g' -i ${sysconfdir}/apache2/httpd.conf - fi -} - -PACKAGES += "${SRCNAME}-base ${PN}-setup" - -FILES:${PN} += "${datadir} \ - ${NAGIOS_PLUGIN_DIR} \ - ${NAGIOS_CGIBIN_DIR} \ -" - -FILES:${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug" - -ALLOW_EMPTY:${SRCNAME}-base = "1" -ALLOW_EMPTY:${PN}-setup = "1" - -SYSTEMD_PACKAGES = "${PN}" -SYSTEMD_SERVICE:${PN} = "nagios-core.service" -SYSTEMD_AUTO_ENABLE:${PN} = "enable" - -USERADD_PACKAGES += "${SRCNAME}-base" -GROUPADD_PARAM:${SRCNAME}-base = "-r ${NAGIOS_GROUP}" -USERADD_PARAM:${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" - -INITSCRIPT_NAME = "nagios" -INITSCRIPT_PARAMS = "defaults" - -CVE_PRODUCT = "nagios_core" - -ALTERNATIVE_PRIORITY_${PN} = '20' -ALTERNATIVE:${PN} = "nagios" -ALTERNATIVE_LINK_NAME[nagios] = "${localstatedir}/nagios" 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 @@ +require nagios-common.inc + +DESCRIPTION = "A host/service/network monitoring and management system core files" +HOMEPAGE = "http://www.nagios.org" +SECTION = "console/network" +PRIORITY = "optional" +LICENSE = "GPL-2.0-only" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae" + +SRCNAME = "nagios" + +SRCREV = "2706fa7a451afe48bd4dc240d72d23fdcec0d9ef" + +SRC_URI = "git://github.com/NagiosEnterprises/nagioscore.git;protocol=https;branch=master \ + file://eventhandlers_nagioscmd_path.patch \ + file://0001-fix-compile-error-of-missing-headers.patch \ + file://0001-fix-segment-fault.patch \ + file://volatiles \ + file://nagios-core.service \ + file://nagios-core-systemd-volatile.conf \ + " + +PV = "4.5.9+git" + +S = "${WORKDIR}/git" + +inherit autotools-brokensep update-rc.d systemd update-alternatives pkgconfig + +DEPENDS = "gd unzip-native openssl" + +RDEPENDS:${PN} += "\ + gd \ + libpng \ + fontconfig \ + apache2 \ + php-cli \ + nagios-base \ +" + +SKIP_RECIPE[nagios-core] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'webserver', '', 'Depends on apache2 from meta-webserver which is not included', d)}" + +acpaths = "-I ${S}/autoconf-macros" +EXTRA_AUTORECONF += "-I ${S}/m4 -I ${S}/autoconf-macros" + +# Set default password for the hardcoded Nagios admin user "nagiosadmin". +# If this variable is empty then will prompt user for password. +NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password" +NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin" + +EXTRA_OECONF += "--sbindir=${NAGIOS_CGIBIN_DIR} \ + --datadir=${datadir}/nagios/htdocs \ + --with-command-group=nagcmd \ + --with-httpd-conf=${sysconfdir}/apache2/conf.d \ + --with-lockfile=${localstatedir}/run/nagios/nagios.pid \ + --with-initdir=${sysconfdir}/init.d \ + --with-init-type=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'sysv', d)} \ + --with-inetd-type=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'inetd', d)} \ +" + +# Prevent nagios from stripping binaries, bitbake will take care of that +EXTRA_OECONF += "ac_cv_path_STRIP=true" + +# Prevent nagios from using dynamic libtool library +EXTRA_OECONF += "ac_cv_header_ltdl_h=no" + +# Prevent nagios from suffering host contamination if host has /bin/perl +EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl" + +# Fix build failure for gcc-10 +CFLAGS:append = " -fcommon" + +# Set to "1" to allow nagios-core post-init to modify Apache configuration +NAGIOS_MODIFY_APACHE ??= "1" + +do_configure:prepend() { + # rename these macros to have .m4 suffix so that autoreconf could recognize them + for macro in `ls ${S}/autoconf-macros/ax_nagios_get_*`; do + mv $macro $macro.m4 + done +} + +do_compile() { + oe_runmake all +} + +do_install() { + oe_runmake 'DESTDIR=${D}' install-unstripped + oe_runmake 'DESTDIR=${D}' install-init + oe_runmake 'DESTDIR=${D}' install-config + oe_runmake 'DESTDIR=${D}' install-commandmode + + install -d ${D}${sysconfdir}/apache2/conf.d + oe_runmake 'DESTDIR=${D}' install-webconf + + install -d ${D}${NAGIOS_PLUGIN_CONF_DIR} + + # There is no install target for the contributed eventhandlers so we + # just do it. + install -d ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers + for f in ${S}/contrib/eventhandlers/* ; do + if ! [ -f $f ] ; then + continue; + fi + install $f ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers/ + done + + echo "cfg_dir=${NAGIOS_PLUGIN_CONF_DIR}" >> ${D}${NAGIOS_CONF_DIR}/nagios.cfg + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${UNPACKDIR}/nagios-core.service ${D}${systemd_unitdir}/system/ + # use our own service file + nagios_default_service=$(find ${D} -name 'nagios.service') + if [ -n "$nagios_default_service" ]; then + rm -f $nagios_default_service + fi + install -d ${D}${sysconfdir}/tmpfiles.d + install -m 755 ${UNPACKDIR}/nagios-core-systemd-volatile.conf ${D}${sysconfdir}/tmpfiles.d/nagios-core-volatile.conf + else + install -d ${D}${sysconfdir}/default/volatiles + install -m 0644 ${UNPACKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/99_nagios + fi +} + +pkg_postinst_ontarget:${PN}-setup () { + # Set password for nagiosadmin user + if [ -z "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" ]; then + htpasswd -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin + else + htpasswd -b -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin \ + "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" + fi + + # Apache2 might by default turn off CGI + if [ "${NAGIOS_MODIFY_APACHE}" == "1" ] && [ -f "${sysconfdir}/apache2/httpd.conf" ]; then + sed -e 's/^#LoadModule cgid_module/LoadModule cgid_module/g' -i ${sysconfdir}/apache2/httpd.conf + fi +} + +PACKAGES += "${SRCNAME}-base ${PN}-setup" + +FILES:${PN} += "${datadir} \ + ${NAGIOS_PLUGIN_DIR} \ + ${NAGIOS_CGIBIN_DIR} \ +" + +FILES:${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug" + +ALLOW_EMPTY:${SRCNAME}-base = "1" +ALLOW_EMPTY:${PN}-setup = "1" + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "nagios-core.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +USERADD_PACKAGES += "${SRCNAME}-base" +GROUPADD_PARAM:${SRCNAME}-base = "-r ${NAGIOS_GROUP}" +USERADD_PARAM:${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" + +INITSCRIPT_NAME = "nagios" +INITSCRIPT_PARAMS = "defaults" + +CVE_PRODUCT = "nagios_core" + +ALTERNATIVE_PRIORITY_${PN} = '20' +ALTERNATIVE:${PN} = "nagios" +ALTERNATIVE_LINK_NAME[nagios] = "${localstatedir}/nagios" -- cgit v1.2.3-54-g00ecf