From 403b591f0104d36ebd13eaddf6da2263941b8eae Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Mon, 8 Jun 2015 18:37:33 +0100 Subject: Initial commit --- .SRCINFO | 61 +++++++++++++++++++++++++++++ PKGBUILD | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ naemon.install | 19 +++++++++ naemon.service | 18 +++++++++ 4 files changed, 218 insertions(+) create mode 100644 .SRCINFO create mode 100644 PKGBUILD create mode 100644 naemon.install create mode 100644 naemon.service diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..356c51e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,61 @@ +# Generated by makepkg 4.2.1 +# Tue Apr 21 14:57:11 UTC 2015 +pkgbase = naemon + pkgver = 1.0.3 + pkgrel = 1 + url = http://naemon.org + arch = i686 + arch = x86_64 + license = GPL2 + makedepends = gperf + makedepends = rsync + makedepends = gd + makedepends = mariadb-clients + source = http://labs.consol.de/naemon/release/v1.0.3/src/naemon-1.0.3.tar.gz + source = naemon.service + md5sums = 0d6873669bd44375978c97174529e258 + md5sums = d6a77534e612e8f65ff3360336faec77 + +pkgname = naemon-core + pkgdesc = System and network monitoring application + install = naemon.install + depends = bash + optdepends = logrotate + optdepends = monitoring-plugins + backup = etc/logrotate.d/naemon + backup = etc/naemon/conf.d/commands.cfg + backup = etc/naemon/conf.d/contacts.cfg + backup = etc/naemon/conf.d/localhost.cfg + backup = etc/naemon/conf.d/printer.cfg + backup = etc/naemon/conf.d/switch.cfg + backup = etc/naemon/conf.d/templates/contacts.cfg + backup = etc/naemon/conf.d/templates/hosts.cfg + backup = etc/naemon/conf.d/templates/services.cfg + backup = etc/naemon/conf.d/timeperiods.cfg + backup = etc/naemon/conf.d/windows.cfg + backup = etc/naemon/naemon.cfg + backup = etc/naemon/resource.cfg + +pkgname = naemon-livestatus + pkgdesc = Standard API for Naemon + depends = icu + +pkgname = naemon-thruk + pkgdesc = Monitoring Webinterface for Naemon + depends = gd + depends = mariadb-clients + depends = apache + depends = mod_fcgid + backup = etc/naemon/cgi.cfg + backup = etc/naemon/htpasswd + backup = etc/naemon/log4perl.conf + backup = etc/naemon/menu_local.conf + backup = etc/naemon/naglint.conf + backup = etc/httpd/conf/extra/thruk.conf + backup = etc/httpd/conf/extra/thruk_cookie_auth_vhost.conf + backup = etc/naemon/thruk_local.conf + backup = etc/naemon/thruk.conf + backup = etc/naemon/conf.d/thruk_bp_generated.cfg + backup = etc/naemon/conf.d/thruk_templates.cfg + backup = etc/logrotate.d/thruk + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..01f7a64 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,120 @@ +# Maintainer: Jonathan Steel + +pkgbase=naemon +pkgname=('naemon-core' 'naemon-livestatus' 'naemon-thruk') +pkgver=1.0.3 +pkgrel=1 +arch=('i686' 'x86_64') +url="http://naemon.org" +license=('GPL2') +makedepends=('gperf' 'rsync' 'gd' 'mariadb-clients') +source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgbase-$pkgver.tar.gz + $pkgbase.service) +md5sums=('0d6873669bd44375978c97174529e258' + 'd6a77534e612e8f65ff3360336faec77') + +prepare() { + cd $pkgbase-$pkgver + + # Break up the install process so we can package the separate components + sed -i '60iinstall-livestatus:' Makefile + sed -i '62iinstall-thruk:' Makefile +} + +build() { + cd $pkgbase-$pkgver + + ./configure --prefix=/usr \ + --bindir=/usr/bin \ + --datadir="/usr/share/naemon" \ + --libdir="/usr/lib/naemon" \ + --localstatedir="/var/lib/naemon" \ + --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" \ + --with-logdir="/var/log/naemon" \ + --with-initdir="/etc/init.d" \ + --with-logrotatedir="/etc/logrotate.d" \ + --with-naemon-user="naemon" \ + --with-naemon-group="naemon" \ + --with-lockfile="/run/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" + + make +} + +check() { + cd $pkgbase-$pkgver/naemon-core + + make check +} + +package_naemon-core() { +pkgdesc="System and network monitoring application" +depends=('bash') +optdepends=('logrotate' + 'monitoring-plugins') +backup=('etc/logrotate.d/naemon' 'etc/naemon/conf.d/commands.cfg' + 'etc/naemon/conf.d/contacts.cfg' 'etc/naemon/conf.d/localhost.cfg' + 'etc/naemon/conf.d/printer.cfg' 'etc/naemon/conf.d/switch.cfg' + 'etc/naemon/conf.d/templates/contacts.cfg' + 'etc/naemon/conf.d/templates/hosts.cfg' + 'etc/naemon/conf.d/templates/services.cfg' + 'etc/naemon/conf.d/timeperiods.cfg' 'etc/naemon/conf.d/windows.cfg' + 'etc/naemon/naemon.cfg' 'etc/naemon/resource.cfg') +install=$pkgbase.install + + cd $pkgbase-$pkgver + + make DESTDIR="$pkgdir" install + + chown -R 44:44 "$pkgdir"/var/{cache,log}/$pkgbase + chmod -R 770 "$pkgdir"/var/{cache,log}/$pkgbase + + install -Dm644 "$srcdir"/$pkgbase.service \ + "$pkgdir"/usr/lib/systemd/system/$pkgbase.service + + # Remove init script + rm -rf "$pkgdir"/etc/init.d +} + +package_naemon-livestatus() { +pkgdesc="Standard API for Naemon" +depends=('icu') + + cd $pkgbase-$pkgver + + make DESTDIR="$pkgdir" install-livestatus +} + +package_naemon-thruk() { +pkgdesc="Monitoring Webinterface for Naemon" +depends=('gd' 'mariadb-clients' 'apache' 'mod_fcgid') +backup=('etc/naemon/cgi.cfg' 'etc/naemon/htpasswd' + 'etc/naemon/log4perl.conf' 'etc/naemon/menu_local.conf' + 'etc/naemon/naglint.conf' 'etc/httpd/conf/extra/thruk.conf' + 'etc/httpd/conf/extra/thruk_cookie_auth_vhost.conf' + 'etc/naemon/thruk_local.conf' 'etc/naemon/thruk.conf' + 'etc/naemon/conf.d/thruk_bp_generated.cfg' + 'etc/naemon/conf.d/thruk_templates.cfg' 'etc/logrotate.d/thruk') + + cd $pkgbase-$pkgver + + make DESTDIR="$pkgdir" install-thruk + + chown -R 44:44 "$pkgdir"/var/{cache,lib,log}/$pkgbase + chmod -R 770 "$pkgdir"/var/{cache,lib,log}/$pkgbase + + # Remove init script + rm -rf "$pkgdir"/etc/init.d +} diff --git a/naemon.install b/naemon.install new file mode 100644 index 0000000..429505a --- /dev/null +++ b/naemon.install @@ -0,0 +1,19 @@ +pre_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 +} + +pre_upgrade() { + pre_install +} + +pre_remove() { + if [[ -f /run/naemon/naemon.pid ]]; then + systemctl stop naemon + fi +} + +post_remove() { + userdel naemon +} diff --git a/naemon.service b/naemon.service new file mode 100644 index 0000000..6b3edc8 --- /dev/null +++ b/naemon.service @@ -0,0 +1,18 @@ +[Unit] +Description=Naemon Monitoring Daemon +Documentation=http://naemon.org/documentation +After=network.target + +[Service] +Type=simple +PIDFile=/run/naemon.pid +ExecStartPre=/usr/bin/naemon -vp /etc/naemon/naemon.cfg +ExecStart=/usr/bin/naemon /etc/naemon/naemon.cfg +ExecReload=/bin/kill -HUP $MAINPID +User=naemon +Group=naemon +StandardOutput=journal +StandardError=inherit + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3 From 424e3203e0a5d7ea31088dca2f7813abc8489979 Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Wed, 27 Apr 2016 21:31:42 +0100 Subject: We should not remove users/groups when packages are uninstalled https://lists.archlinux.org/pipermail/arch-dev-public/2015-February/026953.html --- .SRCINFO | 6 +++--- PKGBUILD | 2 +- naemon.install | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 356c51e..fc51057 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,8 +1,8 @@ -# Generated by makepkg 4.2.1 -# Tue Apr 21 14:57:11 UTC 2015 +# Generated by mksrcinfo v8 +# Wed Apr 27 20:26:08 UTC 2016 pkgbase = naemon pkgver = 1.0.3 - pkgrel = 1 + pkgrel = 2 url = http://naemon.org arch = i686 arch = x86_64 diff --git a/PKGBUILD b/PKGBUILD index 01f7a64..84e901b 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ pkgbase=naemon pkgname=('naemon-core' 'naemon-livestatus' 'naemon-thruk') pkgver=1.0.3 -pkgrel=1 +pkgrel=2 arch=('i686' 'x86_64') url="http://naemon.org" license=('GPL2') diff --git a/naemon.install b/naemon.install index 429505a..d5b5b5f 100644 --- a/naemon.install +++ b/naemon.install @@ -13,7 +13,3 @@ pre_remove() { systemctl stop naemon fi } - -post_remove() { - userdel naemon -} -- cgit v1.2.3 From c39c145492ad0fa217df8285b5364cafdc236787 Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Tue, 7 Jun 2016 15:00:21 +0100 Subject: Prepare for 1.0.4 update --- PKGBUILD | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 84e901b..92d0224 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,23 +2,23 @@ pkgbase=naemon pkgname=('naemon-core' 'naemon-livestatus' 'naemon-thruk') -pkgver=1.0.3 -pkgrel=2 +pkgver=1.0.4 +pkgrel=1 arch=('i686' 'x86_64') url="http://naemon.org" license=('GPL2') -makedepends=('gperf' 'rsync' 'gd' 'mariadb-clients') +makedepends=('gperf' 'rsync' 'gd' 'mariadb-clients' 'help2man') source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgbase-$pkgver.tar.gz $pkgbase.service) -md5sums=('0d6873669bd44375978c97174529e258' +md5sums=('f0d5b8ce43debf78e82994c7ad995d57' 'd6a77534e612e8f65ff3360336faec77') prepare() { cd $pkgbase-$pkgver # Break up the install process so we can package the separate components - sed -i '60iinstall-livestatus:' Makefile - sed -i '62iinstall-thruk:' Makefile + sed -i '51iinstall-livestatus:' Makefile + sed -i '53iinstall-thruk:' Makefile } build() { -- cgit v1.2.3 From 859eea34b10a6f60c39c150edc3e41e9146bea6e Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Thu, 4 May 2017 14:48:40 +0100 Subject: 1.0.6 naemon-thruk has been moved out and is now packaged separately as thruk; this is upstreams direction. naemon-livestatus no longer builds without naemon-core so to keep packaging/building simple I've combined them into "naemon". --- .SRCINFO | 55 ++++++++++++---------------------- PKGBUILD | 103 ++++++++++++++++++++++----------------------------------------- 2 files changed, 54 insertions(+), 104 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index fc51057..892fc08 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,27 +1,27 @@ # Generated by mksrcinfo v8 -# Wed Apr 27 20:26:08 UTC 2016 +# Thu May 4 13:48:32 UTC 2017 pkgbase = naemon - pkgver = 1.0.3 - pkgrel = 2 + pkgdesc = System and network monitoring application + pkgver = 1.0.6 + pkgrel = 1 url = http://naemon.org + install = naemon.install arch = i686 arch = x86_64 license = GPL2 makedepends = gperf - makedepends = rsync - makedepends = gd - makedepends = mariadb-clients - source = http://labs.consol.de/naemon/release/v1.0.3/src/naemon-1.0.3.tar.gz - source = naemon.service - md5sums = 0d6873669bd44375978c97174529e258 - md5sums = d6a77534e612e8f65ff3360336faec77 - -pkgname = naemon-core - pkgdesc = System and network monitoring application - install = naemon.install + makedepends = help2man depends = bash + depends = icu optdepends = logrotate + optdepends = thruk: Web interface for Naemon 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/conf.d/commands.cfg backup = etc/naemon/conf.d/contacts.cfg @@ -35,27 +35,10 @@ pkgname = naemon-core backup = etc/naemon/conf.d/windows.cfg 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 = naemon.service + md5sums = 6c9b95a737a8f232e114f4cff200ff92 + md5sums = d6a77534e612e8f65ff3360336faec77 -pkgname = naemon-livestatus - pkgdesc = Standard API for Naemon - depends = icu - -pkgname = naemon-thruk - pkgdesc = Monitoring Webinterface for Naemon - depends = gd - depends = mariadb-clients - depends = apache - depends = mod_fcgid - backup = etc/naemon/cgi.cfg - backup = etc/naemon/htpasswd - backup = etc/naemon/log4perl.conf - backup = etc/naemon/menu_local.conf - backup = etc/naemon/naglint.conf - backup = etc/httpd/conf/extra/thruk.conf - backup = etc/httpd/conf/extra/thruk_cookie_auth_vhost.conf - backup = etc/naemon/thruk_local.conf - backup = etc/naemon/thruk.conf - backup = etc/naemon/conf.d/thruk_bp_generated.cfg - backup = etc/naemon/conf.d/thruk_templates.cfg - backup = etc/logrotate.d/thruk +pkgname = naemon diff --git a/PKGBUILD b/PKGBUILD index 92d0224..972eb08 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,28 +1,36 @@ # Maintainer: Jonathan Steel -pkgbase=naemon -pkgname=('naemon-core' 'naemon-livestatus' 'naemon-thruk') -pkgver=1.0.4 +pkgname=naemon +pkgver=1.0.6 pkgrel=1 +pkgdesc="System and network monitoring application" arch=('i686' 'x86_64') url="http://naemon.org" license=('GPL2') -makedepends=('gperf' 'rsync' 'gd' 'mariadb-clients' 'help2man') -source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgbase-$pkgver.tar.gz - $pkgbase.service) -md5sums=('f0d5b8ce43debf78e82994c7ad995d57' +depends=('bash' 'icu') +optdepends=('logrotate' + 'thruk: Web interface for Naemon' + '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 + $pkgname.service) +md5sums=('6c9b95a737a8f232e114f4cff200ff92' 'd6a77534e612e8f65ff3360336faec77') - -prepare() { - cd $pkgbase-$pkgver - - # Break up the install process so we can package the separate components - sed -i '51iinstall-livestatus:' Makefile - sed -i '53iinstall-thruk:' Makefile -} +backup=('etc/logrotate.d/naemon' 'etc/naemon/conf.d/commands.cfg' + 'etc/naemon/conf.d/contacts.cfg' 'etc/naemon/conf.d/localhost.cfg' + 'etc/naemon/conf.d/printer.cfg' 'etc/naemon/conf.d/switch.cfg' + 'etc/naemon/conf.d/templates/contacts.cfg' + 'etc/naemon/conf.d/templates/hosts.cfg' + 'etc/naemon/conf.d/templates/services.cfg' + 'etc/naemon/conf.d/timeperiods.cfg' 'etc/naemon/conf.d/windows.cfg' + 'etc/naemon/naemon.cfg' 'etc/naemon/resource.cfg') +install=$pkgname.install build() { - cd $pkgbase-$pkgver + cd $pkgname-$pkgver ./configure --prefix=/usr \ --bindir=/usr/bin \ @@ -54,67 +62,26 @@ build() { } check() { - cd $pkgbase-$pkgver/naemon-core + cd $pkgname-$pkgver/naemon-core make check } -package_naemon-core() { -pkgdesc="System and network monitoring application" -depends=('bash') -optdepends=('logrotate' - 'monitoring-plugins') -backup=('etc/logrotate.d/naemon' 'etc/naemon/conf.d/commands.cfg' - 'etc/naemon/conf.d/contacts.cfg' 'etc/naemon/conf.d/localhost.cfg' - 'etc/naemon/conf.d/printer.cfg' 'etc/naemon/conf.d/switch.cfg' - 'etc/naemon/conf.d/templates/contacts.cfg' - 'etc/naemon/conf.d/templates/hosts.cfg' - 'etc/naemon/conf.d/templates/services.cfg' - 'etc/naemon/conf.d/timeperiods.cfg' 'etc/naemon/conf.d/windows.cfg' - 'etc/naemon/naemon.cfg' 'etc/naemon/resource.cfg') -install=$pkgbase.install - - cd $pkgbase-$pkgver +package() { + cd $pkgname-$pkgver make DESTDIR="$pkgdir" install - chown -R 44:44 "$pkgdir"/var/{cache,log}/$pkgbase - chmod -R 770 "$pkgdir"/var/{cache,log}/$pkgbase - - install -Dm644 "$srcdir"/$pkgbase.service \ - "$pkgdir"/usr/lib/systemd/system/$pkgbase.service - - # Remove init script - rm -rf "$pkgdir"/etc/init.d -} - -package_naemon-livestatus() { -pkgdesc="Standard API for Naemon" -depends=('icu') - - cd $pkgbase-$pkgver - - make DESTDIR="$pkgdir" install-livestatus -} - -package_naemon-thruk() { -pkgdesc="Monitoring Webinterface for Naemon" -depends=('gd' 'mariadb-clients' 'apache' 'mod_fcgid') -backup=('etc/naemon/cgi.cfg' 'etc/naemon/htpasswd' - 'etc/naemon/log4perl.conf' 'etc/naemon/menu_local.conf' - 'etc/naemon/naglint.conf' 'etc/httpd/conf/extra/thruk.conf' - 'etc/httpd/conf/extra/thruk_cookie_auth_vhost.conf' - 'etc/naemon/thruk_local.conf' 'etc/naemon/thruk.conf' - 'etc/naemon/conf.d/thruk_bp_generated.cfg' - 'etc/naemon/conf.d/thruk_templates.cfg' 'etc/logrotate.d/thruk') - - cd $pkgbase-$pkgver + install -d "$pkgdir"/etc/naemon/module-conf.d + install -d "$pkgdir"/var/lib/naemon - make DESTDIR="$pkgdir" install-thruk + chown -R 44:44 "$pkgdir"/var/{cache,lib,log}/$pkgname + chmod -R 770 "$pkgdir"/var/{cache,lib,log}/$pkgname - chown -R 44:44 "$pkgdir"/var/{cache,lib,log}/$pkgbase - chmod -R 770 "$pkgdir"/var/{cache,lib,log}/$pkgbase + install -Dm644 "$srcdir"/$pkgname.service \ + "$pkgdir"/usr/lib/systemd/system/$pkgname.service - # Remove init script + # Remove non-Arch directories rm -rf "$pkgdir"/etc/init.d + rm -rf "$pkgdir"/etc/apache2 } -- cgit v1.2.3 From 8b3611ea43fa522fef0cb316442511f0eabcb4fe Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Fri, 12 May 2017 09:34:58 +0100 Subject: Move sample config files so they don't pollute the config directory on updates --- .SRCINFO | 16 +++------------- PKGBUILD | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 892fc08..a20987c 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Thu May 4 13:48:32 UTC 2017 +# Fri May 12 08:34:54 UTC 2017 pkgbase = naemon pkgdesc = System and network monitoring application pkgver = 1.0.6 - pkgrel = 1 + pkgrel = 2 url = http://naemon.org install = naemon.install arch = i686 @@ -11,8 +11,8 @@ pkgbase = naemon license = GPL2 makedepends = gperf makedepends = help2man - depends = bash depends = icu + depends = glib2 optdepends = logrotate optdepends = thruk: Web interface for Naemon optdepends = monitoring-plugins @@ -23,16 +23,6 @@ pkgbase = naemon replaces = naemon-core replaces = naemon-livestatus backup = etc/logrotate.d/naemon - backup = etc/naemon/conf.d/commands.cfg - backup = etc/naemon/conf.d/contacts.cfg - backup = etc/naemon/conf.d/localhost.cfg - backup = etc/naemon/conf.d/printer.cfg - backup = etc/naemon/conf.d/switch.cfg - backup = etc/naemon/conf.d/templates/contacts.cfg - backup = etc/naemon/conf.d/templates/hosts.cfg - backup = etc/naemon/conf.d/templates/services.cfg - backup = etc/naemon/conf.d/timeperiods.cfg - backup = etc/naemon/conf.d/windows.cfg 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 diff --git a/PKGBUILD b/PKGBUILD index 972eb08..7068a06 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,12 +2,12 @@ pkgname=naemon pkgver=1.0.6 -pkgrel=1 +pkgrel=2 pkgdesc="System and network monitoring application" arch=('i686' 'x86_64') url="http://naemon.org" license=('GPL2') -depends=('bash' 'icu') +depends=('icu' 'glib2') optdepends=('logrotate' 'thruk: Web interface for Naemon' 'monitoring-plugins') @@ -19,14 +19,9 @@ source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgname-$pkgver.tar.g $pkgname.service) md5sums=('6c9b95a737a8f232e114f4cff200ff92' 'd6a77534e612e8f65ff3360336faec77') -backup=('etc/logrotate.d/naemon' 'etc/naemon/conf.d/commands.cfg' - 'etc/naemon/conf.d/contacts.cfg' 'etc/naemon/conf.d/localhost.cfg' - 'etc/naemon/conf.d/printer.cfg' 'etc/naemon/conf.d/switch.cfg' - 'etc/naemon/conf.d/templates/contacts.cfg' - 'etc/naemon/conf.d/templates/hosts.cfg' - 'etc/naemon/conf.d/templates/services.cfg' - 'etc/naemon/conf.d/timeperiods.cfg' 'etc/naemon/conf.d/windows.cfg' - 'etc/naemon/naemon.cfg' 'etc/naemon/resource.cfg') +backup=('etc/logrotate.d/naemon' + 'etc/naemon/naemon.cfg' + 'etc/naemon/resource.cfg') install=$pkgname.install build() { @@ -73,14 +68,19 @@ package() { make DESTDIR="$pkgdir" install install -d "$pkgdir"/etc/naemon/module-conf.d - install -d "$pkgdir"/var/lib/naemon + 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 770 "$pkgdir"/var/{cache,lib,log}/$pkgname install -Dm644 "$srcdir"/$pkgname.service \ "$pkgdir"/usr/lib/systemd/system/$pkgname.service + # Move sample config files + mv "$pkgdir"/etc/naemon/conf.d "$pkgdir"/etc/naemon/examples + install -d "$pkgdir"/etc/naemon/conf.d/templates + # Remove non-Arch directories rm -rf "$pkgdir"/etc/init.d rm -rf "$pkgdir"/etc/apache2 -- cgit v1.2.3 From 679640f802129af0a8e9a4b6f9f31ccfd86fa2f9 Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Tue, 16 May 2017 08:43:42 +0100 Subject: Fix permissions for logrotate --- .SRCINFO | 4 ++-- PKGBUILD | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index a20987c..a2da202 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Fri May 12 08:34:54 UTC 2017 +# Tue May 16 07:43:28 UTC 2017 pkgbase = naemon pkgdesc = System and network monitoring application pkgver = 1.0.6 - pkgrel = 2 + pkgrel = 3 url = http://naemon.org install = naemon.install arch = i686 diff --git a/PKGBUILD b/PKGBUILD index 7068a06..1511b42 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=naemon pkgver=1.0.6 -pkgrel=2 +pkgrel=3 pkgdesc="System and network monitoring application" arch=('i686' 'x86_64') url="http://naemon.org" @@ -72,7 +72,7 @@ package() { chown -R 44:44 "$pkgdir"/var/{cache,lib,log}/$pkgname chown -R 44:44 "$pkgdir"/etc/naemon - chmod -R 770 "$pkgdir"/var/{cache,lib,log}/$pkgname + chmod -R 750 "$pkgdir"/var/{cache,lib,log}/$pkgname install -Dm644 "$srcdir"/$pkgname.service \ "$pkgdir"/usr/lib/systemd/system/$pkgname.service -- cgit v1.2.3 From 746bfc7e2fd0c246b880b529d02af264a1744e1d Mon Sep 17 00:00:00 2001 From: Jonathan Steel Date: Tue, 13 Jun 2017 14:15:42 +0100 Subject: gcc7 fix and run with --daemon journalctl was very noisy without --daemon --- .SRCINFO | 8 ++- PKGBUILD | 16 ++++- gcc7.patch | 211 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ naemon.service | 6 +- 4 files changed, 232 insertions(+), 9 deletions(-) create mode 100644 gcc7.patch diff --git a/.SRCINFO b/.SRCINFO index a2da202..d2c1bd8 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Tue May 16 07:43:28 UTC 2017 +# Tue Jun 13 13:14:33 UTC 2017 pkgbase = naemon pkgdesc = System and network monitoring application pkgver = 1.0.6 - pkgrel = 3 + pkgrel = 4 url = http://naemon.org install = naemon.install arch = i686 @@ -26,9 +26,11 @@ pkgbase = 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 = naemon.service md5sums = 6c9b95a737a8f232e114f4cff200ff92 - md5sums = d6a77534e612e8f65ff3360336faec77 + md5sums = 4a6d8f9b39335dfe3348a1a20df10dfd + md5sums = 29f1d11c1a7f4f1515b7993c540dabe8 pkgname = naemon diff --git a/PKGBUILD b/PKGBUILD index 1511b42..4ade4bd 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=naemon pkgver=1.0.6 -pkgrel=3 +pkgrel=4 pkgdesc="System and network monitoring application" arch=('i686' 'x86_64') url="http://naemon.org" @@ -16,14 +16,22 @@ 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.service) md5sums=('6c9b95a737a8f232e114f4cff200ff92' - 'd6a77534e612e8f65ff3360336faec77') + '4a6d8f9b39335dfe3348a1a20df10dfd' + '29f1d11c1a7f4f1515b7993c540dabe8') 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 @@ -44,7 +52,7 @@ build() { --with-logrotatedir="/etc/logrotate.d" \ --with-naemon-user="naemon" \ --with-naemon-group="naemon" \ - --with-lockfile="/run/naemon.pid" \ + --with-lockfile="/run/naemon/naemon.pid" \ --with-thruk-user="http" \ --with-thruk-group="naemon" \ --with-thruk-libs="/usr/lib/naemon/perl5" \ @@ -76,6 +84,8 @@ package() { 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 diff --git a/gcc7.patch b/gcc7.patch new file mode 100644 index 0000000..113140e --- /dev/null +++ b/gcc7.patch @@ -0,0 +1,211 @@ +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.service b/naemon.service index 6b3edc8..0c3a0da 100644 --- a/naemon.service +++ b/naemon.service @@ -4,10 +4,10 @@ Documentation=http://naemon.org/documentation After=network.target [Service] -Type=simple -PIDFile=/run/naemon.pid +Type=forking +PIDFile=/run/naemon/naemon.pid ExecStartPre=/usr/bin/naemon -vp /etc/naemon/naemon.cfg -ExecStart=/usr/bin/naemon /etc/naemon/naemon.cfg +ExecStart=/usr/bin/naemon --daemon /etc/naemon/naemon.cfg ExecReload=/bin/kill -HUP $MAINPID User=naemon Group=naemon -- cgit v1.2.3 From a4b20506c21eeead57d134bdf6ac77cd23e1664a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 14 Feb 2019 12:59:12 +0100 Subject: 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 } -- cgit v1.2.3