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

glen glen at pld-linux.org
Thu May 7 21:33:38 CEST 2015


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

    use /var/lib/nagios as nagios $HOME

 nagios.init |  2 +-
 nagios.spec | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/nagios.spec b/nagios.spec
index ae92601..e53d0cf 100644
--- a/nagios.spec
+++ b/nagios.spec
@@ -13,7 +13,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:	4.0.8
-Release:	2
+Release:	3
 License:	GPL v2+
 Group:		Networking
 Source0:	http://downloads.sourceforge.net/nagios/nagios-4.x/%{name}-%{version}/%{name}-%{version}.tar.gz
@@ -74,8 +74,8 @@ BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 %define		_sysconfdir	/etc/%{name}
 %define		cgidir		%{_libdir}/%{name}/cgi
 %define		htmldir		%{_prefix}/share/%{name}
-%define		nagioshome	%{_libdir}/%{name}
 %define		_localstatedir	/var/lib/%{name}
+%define		nagioshome	%{_localstatedir}
 %define		_webapps	/etc/webapps
 %define		_webapp		%{name}
 
@@ -412,6 +412,11 @@ if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; the
 	/usr/sbin/usermod -d %{nagioshome} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
 fi
 %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
@@ -463,6 +468,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 < 4.0.8-2.2
+%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 b23587e..56ebefd 100755
--- 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/09305d70fe0ec0c3bb282df8345b2a72f517e02d



More information about the pld-cvs-commit mailing list