Author: glen                         Date: Wed Apr  2 19:33:49 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- add sudo entry for nagios to invoke /sbin/multipath -l

---- Files affected:
SPECS:
   nagios-plugin-check_multipath.spec (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SPECS/nagios-plugin-check_multipath.spec
diff -u SPECS/nagios-plugin-check_multipath.spec:1.4 
SPECS/nagios-plugin-check_multipath.spec:1.5
--- SPECS/nagios-plugin-check_multipath.spec:1.4        Sun Mar  2 01:21:48 2008
+++ SPECS/nagios-plugin-check_multipath.spec    Wed Apr  2 21:33:44 2008
@@ -1,14 +1,15 @@
 # $Revision$, $Date$
-%define                _plugin check_multipath
+%define                plugin  check_multipath
 Summary:       Nagios plugin to check the state of Linux device mapper 
multipath devices
 Summary(pl.UTF-8):     Wtyczka Nagiosa do sprawdzania stanu urządzeń multipath 
device mappera
-Name:          nagios-plugin-%{_plugin}
+Name:          nagios-plugin-%{plugin}
 Version:       1.0
-Release:       0.4
+Release:       0.6
 License:       GPL v2
 Group:         Networking
 Source0:       %{name}.sh
 URL:           http://tinyurl.com/2aunjl
+Requires(post,postun): sudo
 Requires:      awk
 Requires:      nagios-core
 Requires:      nagios-plugins-libs
@@ -16,7 +17,7 @@
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define                _plugindir      %{_prefix}/lib/nagios/plugins
+%define                plugindir       %{_prefix}/lib/nagios/plugins
 %define                _sysconfdir     /etc/nagios/plugins
 
 %description
@@ -29,30 +30,43 @@
 
 %prep
 %setup -qcT
-install %{SOURCE0} %{_plugin}
+install %{SOURCE0} %{plugin}
 
 cat > nagios.cfg <<'EOF'
 # Usage:
-# %{_plugin}
+# %{plugin}
 define command {
-       command_name    %{_plugin}
-       command_line    %{_plugindir}/%{_plugin}
+       command_name    %{plugin}
+       command_line    %{plugindir}/%{plugin}
 }
 EOF
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_plugindir}}
-install %{_plugin} $RPM_BUILD_ROOT%{_plugindir}/%{_plugin}
-cp -a nagios.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{_plugin}.cfg
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
+install %{plugin} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
+cp -a nagios.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+if ! grep -q '^Cmnd_Alias MULTIPATH' /etc/sudoers; then
+       cat >> /etc/sudoers <<-'EOF'
+               Cmnd_Alias MULTIPATH=/sbin/multipath -l
+               nagios  ALL= NOPASSWD: MULTIPATH
+       EOF
+fi
+
+%postun
+if [ "$1" = 0 ]; then
+       %{__sed} -i -e '/MULTIPATH/d' /etc/sudoers
+fi
+
 %files
 %defattr(644,root,root,755)
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{_plugin}.cfg
-%attr(755,root,root) %{_plugindir}/%{_plugin}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg
+%attr(755,root,root) %{plugindir}/%{plugin}
 
 %define date   %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -60,6 +74,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.5  2008-04-02 19:33:44  glen
+- add sudo entry for nagios to invoke /sbin/multipath -l
+
 Revision 1.4  2008-03-02 00:21:48  qboosh
 - pl
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/nagios-plugin-check_multipath.spec?r1=1.4&r2=1.5&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to