[packages/nagios/nagios-3.2] use /var/lib/nagios as nagios $HOME

glen glen at pld-linux.org
Fri Aug 7 15:17:55 CEST 2015


commit c656baa8558b1f8a6e186ebb43b65a247d8ca2f0
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu May 7 22:32:50 2015 +0300

    use /var/lib/nagios as nagios $HOME
    
    Conflicts:
    	nagios.spec

 nagios.init |  2 +-
 nagios.spec | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/nagios.spec b/nagios.spec
index a784dc9..83e0de2 100644
--- a/nagios.spec
+++ b/nagios.spec
@@ -11,7 +11,7 @@ Summary(pl.UTF-8):	Program do monitorowania serwerów/usług/sieci
 Summary(pt_BR.UTF-8):	Programa para monitoração de máquinas e serviços
 Name:		nagios
 Version:	3.2.3
-Release:	5
+Release:	6
 License:	GPL v2+
 Group:		Networking
 Source0:	http://downloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
@@ -63,6 +63,7 @@ BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 %define		cgidir		%{_libdir}/%{name}/cgi
 %define		htmldir		%{_prefix}/share/%{name}
 %define		_localstatedir	/var/lib/%{name}
+%define		nagioshome	%{_localstatedir}
 %define		_webapps	/etc/webapps
 %define		_webapp		%{name}
 
@@ -343,7 +344,12 @@ fi
 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
 	/usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
 fi
-%useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
+%useradd -u 72 -d %{nagioshome} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
+# update nagios user home
+home=$(IFS=:; set -- $(getent passwd nagios); echo $6)
+if [ "$home" != %{nagioshome} ]; then
+	/usr/sbin/usermod -d %{nagioshome} nagios
+fi
 
 %postun common
 if [ "$1" = "0" ]; then
@@ -395,6 +401,14 @@ for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.c
 done
 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
 
+
+%triggerpostun -- nagios-common < 3.2.3-6
+%banner -e %{name}-common <<EOF
+
+IMPORTANT: nagios user home changed to %{nagioshome}, you may need to move files from previous location %{_libdir}/%{name}.
+
+EOF
+
 %files
 %defattr(644,root,root,755)
 %doc Changelog README* UPGRADING INSTALLING LICENSE
diff --git a/nagios.init b/nagios.init
index 20988bb..28e3874 100644
--- a/nagios.init
+++ b/nagios.init
@@ -29,7 +29,7 @@ cfg_file=/etc/nagios/nagios.cfg
 
 # value to use for $HOME
 # as pld initscript resets HOME=/tmp, plugins may inherit bad value
-nagios_home=/usr/lib/nagios
+nagios_home=/var/lib/nagios
 
 # check for precache
 precached_object_file=$(awk -F= '/^precached_object_file/{print $2}' $cfg_file)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios.git/commitdiff/c656baa8558b1f8a6e186ebb43b65a247d8ca2f0



More information about the pld-cvs-commit mailing list