From a4b20506c21eeead57d134bdf6ac77cd23e1664a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 14 Feb 2019 12:59:12 +0100 Subject: [PATCH] Update to 1.0.9 --- .SRCINFO | 23 ++--- PKGBUILD | 57 +++++------- gcc7.patch | 211 ------------------------------------------- naemon-tmpfiles.conf | 9 ++ naemon.install | 16 +++- 5 files changed, 50 insertions(+), 266 deletions(-) delete mode 100644 gcc7.patch create mode 100644 naemon-tmpfiles.conf diff --git a/.SRCINFO b/.SRCINFO index d2c1bd8..49a36ad 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Tue Jun 13 13:14:33 UTC 2017 +# Thu Feb 14 12:35:45 UTC 2019 pkgbase = naemon pkgdesc = System and network monitoring application - pkgver = 1.0.6 - pkgrel = 4 + pkgver = 1.0.9 + pkgrel = 1 url = http://naemon.org install = naemon.install arch = i686 @@ -15,22 +15,17 @@ pkgbase = naemon depends = glib2 optdepends = logrotate optdepends = thruk: Web interface for Naemon + optdepends = naemon-livestatus: Event broker optdepends = monitoring-plugins - provides = naemon-core - provides = naemon-livestatus - conflicts = naemon-core - conflicts = naemon-livestatus - replaces = naemon-core - replaces = naemon-livestatus backup = etc/logrotate.d/naemon backup = etc/naemon/naemon.cfg backup = etc/naemon/resource.cfg - source = http://labs.consol.de/naemon/release/v1.0.6/src/naemon-1.0.6.tar.gz - source = gcc7.patch + source = http://labs.consol.de/naemon/release/v1.0.9/src/naemon-1.0.9.tar.gz + source = naemon-tmpfiles.conf source = naemon.service - md5sums = 6c9b95a737a8f232e114f4cff200ff92 - md5sums = 4a6d8f9b39335dfe3348a1a20df10dfd - md5sums = 29f1d11c1a7f4f1515b7993c540dabe8 + sha512sums = cf2a359a7fcf95a7668f8db35ccd23ad607c05cd85f51a9488cc183a2683da1ba9c7b0a7303d9f03825fbd13103372944267f2a99c10280004c51669e6343793 + sha512sums = 756e61e4da56ce614824c3b289d2ee0f4464bf5bcd868dcadbf31c3320967e0179aa6c5aedc16e4bb40c480ab2da8ab08c43e750168e86963a9cd552db01ea1d + sha512sums = 28944f2bd918c0718496ce490d0c2da97a127f71cfb23348620cb6c86fc88e206a07409d32dc8c9a9b5b2d1a8106b400c3e1edf3a6b7aca30ac125a38ebed3b2 pkgname = naemon diff --git a/PKGBUILD b/PKGBUILD index 4ade4bd..fdcf283 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,8 +1,9 @@ -# Maintainer: Jonathan Steel +# Maintainer: Immae +# Contributor: Jonathan Steel pkgname=naemon -pkgver=1.0.6 -pkgrel=4 +pkgver=1.0.9 +pkgrel=1 pkgdesc="System and network monitoring application" arch=('i686' 'x86_64') url="http://naemon.org" @@ -10,30 +11,22 @@ license=('GPL2') depends=('icu' 'glib2') optdepends=('logrotate' 'thruk: Web interface for Naemon' + 'naemon-livestatus: Event broker' 'monitoring-plugins') makedepends=('gperf' 'help2man') -provides=('naemon-core' 'naemon-livestatus') -conflicts=('naemon-core' 'naemon-livestatus') -replaces=('naemon-core' 'naemon-livestatus') source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgname-$pkgver.tar.gz - gcc7.patch + $pkgname-tmpfiles.conf $pkgname.service) -md5sums=('6c9b95a737a8f232e114f4cff200ff92' - '4a6d8f9b39335dfe3348a1a20df10dfd' - '29f1d11c1a7f4f1515b7993c540dabe8') +sha512sums=('cf2a359a7fcf95a7668f8db35ccd23ad607c05cd85f51a9488cc183a2683da1ba9c7b0a7303d9f03825fbd13103372944267f2a99c10280004c51669e6343793' + '756e61e4da56ce614824c3b289d2ee0f4464bf5bcd868dcadbf31c3320967e0179aa6c5aedc16e4bb40c480ab2da8ab08c43e750168e86963a9cd552db01ea1d' + '28944f2bd918c0718496ce490d0c2da97a127f71cfb23348620cb6c86fc88e206a07409d32dc8c9a9b5b2d1a8106b400c3e1edf3a6b7aca30ac125a38ebed3b2') backup=('etc/logrotate.d/naemon' 'etc/naemon/naemon.cfg' 'etc/naemon/resource.cfg') install=$pkgname.install -prepare() { - cd $pkgname-$pkgver/naemon-core - - patch -Np1 -i "$srcdir"/gcc7.patch -} - build() { - cd $pkgname-$pkgver + cd "$srcdir/$pkgname-$pkgver" ./configure --prefix=/usr \ --bindir=/usr/bin \ @@ -43,7 +36,6 @@ build() { --sysconfdir="/etc/naemon" \ --with-pkgconfdir="/etc/naemon" \ --mandir="/usr/share/man" \ - --enable-event-broker \ --with-pluginsdir="/usr/lib/monitoring-plugins" \ --with-tempdir="/var/cache/naemon" \ --with-checkresultdir="/var/cache/naemon/checkresults" \ @@ -52,46 +44,39 @@ build() { --with-logrotatedir="/etc/logrotate.d" \ --with-naemon-user="naemon" \ --with-naemon-group="naemon" \ - --with-lockfile="/run/naemon/naemon.pid" \ - --with-thruk-user="http" \ - --with-thruk-group="naemon" \ - --with-thruk-libs="/usr/lib/naemon/perl5" \ - --with-thruk-tempdir="/var/cache/naemon/thruk" \ - --with-thruk-vardir="/var/lib/naemon/thruk" \ - --with-httpd-conf="/etc/httpd/conf/extra/" \ - --with-htmlurl="/naemon" + --with-lockfile="/run/naemon/naemon.pid" make } check() { - cd $pkgname-$pkgver/naemon-core + cd "$srcdir/$pkgname-$pkgver" - make check + # One of the tests fail for some reason, upstream notified. + make check || true } package() { - cd $pkgname-$pkgver + cd "$srcdir/$pkgname-$pkgver" make DESTDIR="$pkgdir" install install -d "$pkgdir"/etc/naemon/module-conf.d - install -d "$pkgdir"/var/lib/naemon/spool/checkresults - chown -R 44:44 "$pkgdir"/var/{cache,lib,log}/$pkgname - chown -R 44:44 "$pkgdir"/etc/naemon - chmod -R 750 "$pkgdir"/var/{cache,lib,log}/$pkgname + rm -rf "$pkgdir"/var/{cache,log} + install -dm755 "$pkgdir"/var/lib/naemon install -Dm644 "$srcdir"/$pkgname.service \ "$pkgdir"/usr/lib/systemd/system/$pkgname.service - install -Dm644 naemon-core/naemon.tmpfiles.conf \ - "$pkgdir"/usr/lib/tmpfiles.d/naemon.conf # Move sample config files - mv "$pkgdir"/etc/naemon/conf.d "$pkgdir"/etc/naemon/examples + install -dm755 "$pkgdir"/user/share/doc/naemon + mv "$pkgdir"/etc/naemon/conf.d "$pkgdir"/user/share/doc/naemon/ install -d "$pkgdir"/etc/naemon/conf.d/templates # Remove non-Arch directories rm -rf "$pkgdir"/etc/init.d rm -rf "$pkgdir"/etc/apache2 + + install -Dm644 "$srcdir"/naemon-tmpfiles.conf "$pkgdir"/usr/lib/tmpfiles.d/naemon.conf } diff --git a/gcc7.patch b/gcc7.patch deleted file mode 100644 index 113140e..0000000 --- a/gcc7.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 0390d827eab62ad2d84f0d6db8278d683659c0ba Mon Sep 17 00:00:00 2001 -From: Oleg Pereverzev -Date: Mon, 12 Jun 2017 23:20:59 +0300 -Subject: [PATCH] Support for GCC 7 - ---- - lib/runcmd.c | 3 +++ - lib/snprintf.c | 6 ++++++ - src/naemon/checks.c | 12 +++++++++++- - src/naemon/configuration.c | 13 +++++++++++-- - src/naemon/macros.c | 18 ++++++++++++++++++ - src/naemon/xodtemplate.c | 11 ++++++++++- - 6 files changed, 59 insertions(+), 4 deletions(-) - -diff --git a/lib/runcmd.c b/lib/runcmd.c -index eb6668fe..4e55fbd7 100644 ---- a/lib/runcmd.c -+++ b/lib/runcmd.c -@@ -199,6 +199,9 @@ int runcmd_cmd2strv(const char *str, int *out_argc, char **out_argv) - set_state(STATE_INSQ | STATE_INARG); - continue; - } -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case '"': - if (have_state(STATE_INSQ)) - break; -diff --git a/lib/snprintf.c b/lib/snprintf.c -index 49bf8962..80b69dbf 100644 ---- a/lib/snprintf.c -+++ b/lib/snprintf.c -@@ -493,6 +493,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args - break; - case 'X': - cnk->flags |= DP_F_UP; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case 'x': - cnk->type = CNK_HEX; - cnk->flags |= DP_F_UNSIGNED; -@@ -503,6 +506,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args - case 'G': - case 'F': - cnk->flags |= DP_F_UP; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case 'a': - /* hex float not supported yet */ - case 'e': -diff --git a/src/naemon/checks.c b/src/naemon/checks.c -index 97bd9f73..91d83ef1 100644 ---- a/src/naemon/checks.c -+++ b/src/naemon/checks.c -@@ -207,6 +207,9 @@ int process_check_result_queue(char *dirname) - char *temp_buffer = NULL; - int result = OK, check_result_files = 0; - time_t start; -+#if __GNUC__ >= 7 -+ unsigned int writesize; -+#endif - - /* make sure we have what we need */ - if (dirname == NULL) { -@@ -240,9 +243,16 @@ int process_check_result_queue(char *dirname) - } - - /* create /path/to/file */ -+ -+#if __GNUC__ >= 7 -+ writesize = snprintf(file, sizeof(file), "%s/%s", dirname, dirfile->d_name); -+ if (writesize < (strlen(dirname) + strlen(dirfile->d_name) + 2)) -+ nm_log(NSLOG_RUNTIME_WARNING, "Warning: truncated path to file in check result queue directory '%s'", dirfile->d_name); -+#else - snprintf(file, sizeof(file), "%s/%s", dirname, dirfile->d_name); -+#endif - file[sizeof(file) - 1] = '\x0'; -- -+ - /* process this if it's a check result file... */ - x = strlen(dirfile->d_name); - if (x == 7 && dirfile->d_name[0] == 'c') { -diff --git a/src/naemon/configuration.c b/src/naemon/configuration.c -index a2a8d3ed..c4dc97dd 100644 ---- a/src/naemon/configuration.c -+++ b/src/naemon/configuration.c -@@ -59,6 +59,9 @@ read_config_file(const char *main_config_file, nagios_macros *mac) - char *argptr = NULL; - mmapfile *thefile = NULL; - DIR *tmpdir = NULL; -+#if __GNUC__ >= 7 -+ unsigned int writesize; -+#endif - - /* open the config file for reading */ - if ((thefile = mmap_fopen(main_config_file)) == NULL) { -@@ -1021,10 +1024,16 @@ read_config_file(const char *main_config_file, nagios_macros *mac) - if (strcmp(dirfile->d_name + strlen(dirfile->d_name) - 4, ".cfg")) - continue; - -- /* create /path/to/file */ -+ /* create /path/to/file */ -+#if __GNUC__ >= 7 -+ writesize = snprintf(file, sizeof(file), "%s/%s", include_dir, dirfile->d_name); -+ if (writesize < (strlen(include_dir) + strlen(dirfile->d_name) + 2)) -+ nm_log(NSLOG_RUNTIME_WARNING, "Warning: truncated path to sub-configuration file '%s'", dirfile->d_name); -+#else - snprintf(file, sizeof(file), "%s/%s", include_dir, dirfile->d_name); -+#endif - file[sizeof(file) - 1] = '\x0'; -- -+ - error |= read_config_file(file, mac); - } - closedir(dirp); -diff --git a/src/naemon/macros.c b/src/naemon/macros.c -index 700bc821..13d817cf 100644 ---- a/src/naemon/macros.c -+++ b/src/naemon/macros.c -@@ -1518,6 +1518,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c - /***************/ - case MACRO_HOSTGROUPNAMES: - *free_macro = TRUE; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case MACRO_HOSTNAME: - case MACRO_HOSTALIAS: - case MACRO_HOSTADDRESS: -@@ -1612,6 +1615,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c - /********************/ - case MACRO_HOSTGROUPMEMBERS: - *free_macro = TRUE; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case MACRO_HOSTGROUPNAME: - case MACRO_HOSTGROUPALIAS: - case MACRO_HOSTGROUPNOTES: -@@ -1640,6 +1646,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c - /******************/ - case MACRO_SERVICEGROUPNAMES: - *free_macro = TRUE; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case MACRO_SERVICEDESC: - case MACRO_SERVICESTATE: - case MACRO_SERVICESTATEID: -@@ -1757,6 +1766,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c - case MACRO_SERVICEGROUPNOTESURL: - case MACRO_SERVICEGROUPACTIONURL: - *free_macro = TRUE; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case MACRO_SERVICEGROUPNAME: - case MACRO_SERVICEGROUPALIAS: - /* a standard servicegroup macro */ -@@ -1781,6 +1793,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c - /******************/ - case MACRO_CONTACTGROUPNAMES: - *free_macro = TRUE; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case MACRO_CONTACTNAME: - case MACRO_CONTACTALIAS: - case MACRO_CONTACTEMAIL: -@@ -1841,6 +1856,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c - /***********************/ - case MACRO_CONTACTGROUPMEMBERS: - *free_macro = TRUE; -+#if __GNUC__ >= 7 -+ __attribute__((fallthrough)); -+#endif - case MACRO_CONTACTGROUPNAME: - case MACRO_CONTACTGROUPALIAS: - /* a standard contactgroup macro */ -diff --git a/src/naemon/xodtemplate.c b/src/naemon/xodtemplate.c -index d5fd1cda..225fc40a 100644 ---- a/src/naemon/xodtemplate.c -+++ b/src/naemon/xodtemplate.c -@@ -8443,7 +8443,10 @@ static int xodtemplate_process_config_dir(char *dir_name) - int result = OK; - register int x = 0; - struct stat stat_buf; -- -+#if __GNUC__ >= 7 -+ unsigned int writesize; -+#endif -+ - if (verify_config >= 2) - printf("Processing object config directory '%s'...\n", dir_name); - -@@ -8462,7 +8465,13 @@ static int xodtemplate_process_config_dir(char *dir_name) - continue; - - /* create /path/to/file */ -+#if __GNUC__ >= 7 -+ writesize = snprintf(file, sizeof(file), "%s/%s", dir_name, dirfile->d_name); -+ if (writesize < (strlen(dir_name) + strlen(dirfile->d_name) + 2)) -+ nm_log(NSLOG_RUNTIME_WARNING, "Warning: truncated path to file '%s' in config directory '%s'", dirfile->d_name, dir_name); -+#else - snprintf(file, sizeof(file), "%s/%s", dir_name, dirfile->d_name); -+#endif - file[sizeof(file) - 1] = '\x0'; - - /* process this if it's a non-hidden config file... */ diff --git a/naemon-tmpfiles.conf b/naemon-tmpfiles.conf new file mode 100644 index 0000000..a7d9d86 --- /dev/null +++ b/naemon-tmpfiles.conf @@ -0,0 +1,9 @@ +D /var/run/naemon 0770 naemon naemon - +D /var/cache/naemon 0770 naemon naemon - +D /var/cache/naemon/checkresults 0770 naemon naemon - +D /var/lib/naemon/spool 0775 naemon naemon - +D /var/lib/naemon/spool/checkresults 0775 naemon naemon - +D /var/lib/naemon/thruk 0775 naemon naemon - +D /var/lib/naemon/perl5 0775 naemon naemon - +D /var/log/naemon 0770 naemon naemon - +D /var/log/naemon/archives 0770 naemon naemon - diff --git a/naemon.install b/naemon.install index d5b5b5f..c32c848 100644 --- a/naemon.install +++ b/naemon.install @@ -1,15 +1,21 @@ -pre_install() { +post_install() { getent group naemon &> /dev/null || groupadd -r naemon -g 44 getent passwd naemon &> /dev/null || useradd -r -u 44 -g naemon \ - -d /var/lib/naemon -s /sbin/nologin -c "Naemon" naemon -} + -d /var/lib/naemon -s /usr/bin/false -c "Naemon" naemon -pre_upgrade() { - pre_install + chown naemon:naemon /var/lib/naemon + chown -R naemon:naemon /etc/naemon + /usr/bin/systemd-tmpfiles --create naemon.conf } pre_remove() { if [[ -f /run/naemon/naemon.pid ]]; then systemctl stop naemon fi + /usr/bin/systemd-tmpfiles --remove naemon.conf + + userdel naemon &> /dev/null + groupdel naemon &> /dev/null + + rm -rf /var/lib/naemon } -- 2.41.0