commit:     667c4d4c33593e983947d5a4ce2f59288bd9dc76
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  2 20:42:36 2017 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Nov  4 23:37:22 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=667c4d4c

net-analyzer/pnp4nagios: use consistent perfdata directories.

Past revisions have stored the RRDtool data and the process_perdata.pl
logs in (for example) /var/nagios or /var/icinga, depending on whether
or you had Nagios or Icinga installed. That's silly: the data format
doesn't change, so it makes more sense to choose one location (now:
/var/lib/pnp) and stick with it.

Package-Manager: Portage-2.3.8, Repoman-2.3.3

 ....6.26-r4.ebuild => pnp4nagios-0.6.26-r5.ebuild} | 32 ++++++++++------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r4.ebuild 
b/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r5.ebuild
similarity index 78%
rename from net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r4.ebuild
rename to net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r5.ebuild
index c173abd999e..3e886eb89dc 100644
--- a/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r4.ebuild
+++ b/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r5.ebuild
@@ -38,27 +38,16 @@ RDEPEND="${DEPEND}
 PATCHES=( "${FILESDIR}/${PN}-0.6.14-makefile.patch" )
 
 src_configure() {
-       local var_dir user_group
-
-       if use icinga; then
-               var_dir=/var/lib/icinga
-               user_group=icinga
-       elif use icinga2; then
-               var_dir=/var/lib/icinga2
-               user_group=icinga
-       else
-               # Thanks to REQUIRED_USE, "use nagios" is the only other case.
-               var_dir=/var/nagios
-               user_group=nagios
-       fi
+       local user_group=nagios
+       ( use icinga || use icinga2 ) && user_group=icinga
 
        econf \
                --sysconfdir="${EPREFIX}"/etc/pnp \
                --datarootdir="${EPREFIX}"/usr/share/pnp \
-               --with-perfdata-dir="${EPREFIX}"${var_dir}/perfdata \
-               --with-nagios-user=${user_group} \
-               --with-nagios-group=${user_group} \
-               --with-perfdata-logfile="${EPREFIX}"${var_dir}/perfdata.log \
+               --with-nagios-user="${user_group}" \
+               --with-nagios-group="${user_group}" \
+               --with-perfdata-dir="${EPREFIX}"/var/lib/pnp/perfdata \
+               
--with-perfdata-logfile="${EPREFIX}"/var/log/pnp/process_perfdata.log \
                --with-perfdata-spool-dir="${EPREFIX}"/var/spool/pnp
 }
 
@@ -88,6 +77,15 @@ src_install() {
                # server read it.
                fowners :apache /etc/pnp/process_perfdata.cfg
        fi
+
+       # The nagios or icinga user will also need to be able to write
+       # performance data to the perfdata-dir and perfdata-spool-dir
+       # directories.
+       local user_group=nagios
+       ( use icinga || use icinga2 ) && user_group=icinga
+       dodir /var/lib/pnp/{,perfdata} /var/log/pnp
+       fowners "${user_group}:${user_group}" /var/lib/pnp/{,perfdata}
+       fowners "${user_group}:${user_group}" /var/log/pnp
 }
 
 pkg_postinst() {

Reply via email to