[nrpe] Allow user to redefine default commands

Peter Lemenkov peter at fedoraproject.org
Wed Oct 16 15:02:54 UTC 2013


commit c51978e0a6b8dd0bf69c3822162024ba00002985
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Wed Oct 16 19:02:47 2013 +0400

    Allow user to redefine default commands
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 ...0001-Add-reload-target-to-the-init-script.patch |   10 ++--
 ...tra-configuration-from-etc-sysconfig-nrpe.patch |   10 ++--
 ...-0003-Include-etc-npre.d-config-directory.patch |   14 ++--
 nrpe-0004-Fix-initscript-return-codes.patch        |   10 ++--
 nrpe-0005-Do-not-start-by-default.patch            |   10 ++--
 nrpe-0006-Relocate-pid-file.patch                  |   12 ++--
 ...drestart-try-restart-target-to-initscript.patch |    8 +-
 ...to-override-all-defaults-even-command-def.patch |   45 +++++++++++++
 nrpe.spec                                          |   69 ++++++++++++-------
 9 files changed, 125 insertions(+), 63 deletions(-)
---
diff --git a/nrpe-0001-Add-reload-target-to-the-init-script.patch b/nrpe-0001-Add-reload-target-to-the-init-script.patch
index efe9c7a..80341aa 100644
--- a/nrpe-0001-Add-reload-target-to-the-init-script.patch
+++ b/nrpe-0001-Add-reload-target-to-the-init-script.patch
@@ -1,11 +1,11 @@
-From 0a988e01a0b2e1859990a26198d6c8adee001cca Mon Sep 17 00:00:00 2001
+From a3528084ceb16047ccfec1b8a0a04dddec9535d3 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 18 Jun 2010 13:45:05 +0400
-Subject: [PATCH 1/6] Add reload target to the init-script
+Subject: [PATCH 1/8] Add reload target to the init-script
 
 ---
- init-script.in |    7 ++++++-
- 1 files changed, 6 insertions(+), 1 deletions(-)
+ init-script.in | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/init-script.in b/init-script.in
 index 07b17c7..0bd7629 100644
@@ -30,5 +30,5 @@ index 07b17c7..0bd7629 100644
  esac
  
 -- 
-1.6.6.1
+1.8.3.1
 
diff --git a/nrpe-0002-Read-extra-configuration-from-etc-sysconfig-nrpe.patch b/nrpe-0002-Read-extra-configuration-from-etc-sysconfig-nrpe.patch
index 9c0af8c..3a93ffa 100644
--- a/nrpe-0002-Read-extra-configuration-from-etc-sysconfig-nrpe.patch
+++ b/nrpe-0002-Read-extra-configuration-from-etc-sysconfig-nrpe.patch
@@ -1,13 +1,13 @@
-From 34c2f96a4e2582f13bc07d8d03a128a31e06813f Mon Sep 17 00:00:00 2001
+From bd0add531b840f6419794e4d628e816658272ef3 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 18 Jun 2010 13:46:00 +0400
-Subject: [PATCH 2/6] Read extra configuration from /etc/sysconfig/nrpe
+Subject: [PATCH 2/8] Read extra configuration from /etc/sysconfig/nrpe
 
 See this rhbz for the details:
 https://bugzilla.redhat.com/show_bug.cgi?id=449174
 ---
- init-script.in |    7 ++++++-
- 1 files changed, 6 insertions(+), 1 deletions(-)
+ init-script.in | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/init-script.in b/init-script.in
 index 0bd7629..720a96d 100644
@@ -35,5 +35,5 @@ index 0bd7629..720a96d 100644
  	touch $LockFile
  	;;
 -- 
-1.6.6.1
+1.8.3.1
 
diff --git a/nrpe-0003-Include-etc-npre.d-config-directory.patch b/nrpe-0003-Include-etc-npre.d-config-directory.patch
index 61f4014..2c176fd 100644
--- a/nrpe-0003-Include-etc-npre.d-config-directory.patch
+++ b/nrpe-0003-Include-etc-npre.d-config-directory.patch
@@ -1,19 +1,19 @@
-From b91826cbeb34744623bce7d07a2c905d993742d2 Mon Sep 17 00:00:00 2001
+From f36f87ebddfa7156ab12af8020274331444403bd Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 18 Jun 2010 13:46:53 +0400
-Subject: [PATCH 3/6] Include /etc/npre.d config directory
+Subject: [PATCH 3/8] Include /etc/npre.d config directory
 
 See this rhbz for the details:
 https://bugzilla.redhat.com/show_bug.cgi?id=515324
 ---
- sample-config/nrpe.cfg.in |    3 +--
- 1 files changed, 1 insertions(+), 2 deletions(-)
+ sample-config/nrpe.cfg.in | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/sample-config/nrpe.cfg.in b/sample-config/nrpe.cfg.in
-index 36575c0..d72ab3b 100644
+index da6a280..1b72141 100644
 --- a/sample-config/nrpe.cfg.in
 +++ b/sample-config/nrpe.cfg.in
-@@ -169,8 +169,7 @@ connection_timeout=300
+@@ -189,8 +189,7 @@ connection_timeout=300
  # This directive allows you to include definitions from config files (with a
  # .cfg extension) in one or more directories (with recursion).
  
@@ -24,5 +24,5 @@ index 36575c0..d72ab3b 100644
  
  
 -- 
-1.6.6.1
+1.8.3.1
 
diff --git a/nrpe-0004-Fix-initscript-return-codes.patch b/nrpe-0004-Fix-initscript-return-codes.patch
index 08bc13a..b4fdfec 100644
--- a/nrpe-0004-Fix-initscript-return-codes.patch
+++ b/nrpe-0004-Fix-initscript-return-codes.patch
@@ -1,13 +1,13 @@
-From 3f8de2285a40f764c800de0ed4e4a7b0f8817656 Mon Sep 17 00:00:00 2001
+From e41bce1404c055a6c2e9c17fcf89443142fc552b Mon Sep 17 00:00:00 2001
 From: Ricky Zhou <rzhou at redhat.com>
 Date: Fri, 18 Jun 2010 14:02:02 +0400
-Subject: [PATCH 4/6] Fix initscript return codes
+Subject: [PATCH 4/8] Fix initscript return codes
 
 See this rhbz for the details:
 https://bugzilla.redhat.com/show_bug.cgi?id=567141
 ---
- init-script.in |   14 ++++++++++----
- 1 files changed, 10 insertions(+), 4 deletions(-)
+ init-script.in | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
 
 diff --git a/init-script.in b/init-script.in
 index 720a96d..186c757 100644
@@ -61,5 +61,5 @@ index 720a96d..186c757 100644
 -exit 0
 +exit $RETVAL
 -- 
-1.6.6.1
+1.8.3.1
 
diff --git a/nrpe-0005-Do-not-start-by-default.patch b/nrpe-0005-Do-not-start-by-default.patch
index 0138b15..abd07bc 100644
--- a/nrpe-0005-Do-not-start-by-default.patch
+++ b/nrpe-0005-Do-not-start-by-default.patch
@@ -1,11 +1,11 @@
-From cc3d3d04d9ae9ec4e8036784b60fc378908c57f7 Mon Sep 17 00:00:00 2001
+From 0c0bf12492b81b53bed71901e1d2a43d3cc4e7c0 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 18 Jun 2010 14:11:33 +0400
-Subject: [PATCH 5/6] Do not start by default
+Subject: [PATCH 5/8] Do not start by default
 
 ---
- init-script.in |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ init-script.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/init-script.in b/init-script.in
 index 186c757..ed6c366 100644
@@ -21,5 +21,5 @@ index 186c757..ed6c366 100644
  #              running nagios plugins on this host.
  # processname: nrpe
 -- 
-1.6.6.1
+1.8.3.1
 
diff --git a/nrpe-0006-Relocate-pid-file.patch b/nrpe-0006-Relocate-pid-file.patch
index 3e8707c..be13c60 100644
--- a/nrpe-0006-Relocate-pid-file.patch
+++ b/nrpe-0006-Relocate-pid-file.patch
@@ -1,16 +1,16 @@
-From c58026d6a575222dcfd40c49959ccfde6d2cb581 Mon Sep 17 00:00:00 2001
+From 080da5b0438bbdfac29ebb37919c870336bf759d Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 18 Jun 2010 14:14:13 +0400
-Subject: [PATCH 6/6] Relocate pid-file
+Subject: [PATCH 6/8] Relocate pid-file
 
 See this rhbz for the details:
 https://bugzilla.redhat.com/show_bug.cgi?id=575544
 ---
- sample-config/nrpe.cfg.in |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ sample-config/nrpe.cfg.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/sample-config/nrpe.cfg.in b/sample-config/nrpe.cfg.in
-index d72ab3b..a31df4b 100644
+index 1b72141..20eb927 100644
 --- a/sample-config/nrpe.cfg.in
 +++ b/sample-config/nrpe.cfg.in
 @@ -23,7 +23,7 @@ log_facility=@log_facility@
@@ -23,5 +23,5 @@ index d72ab3b..a31df4b 100644
  
  
 -- 
-1.6.6.1
+1.8.3.1
 
diff --git a/nrpe-0007-Add-condrestart-try-restart-target-to-initscript.patch b/nrpe-0007-Add-condrestart-try-restart-target-to-initscript.patch
index d894713..fa4281e 100644
--- a/nrpe-0007-Add-condrestart-try-restart-target-to-initscript.patch
+++ b/nrpe-0007-Add-condrestart-try-restart-target-to-initscript.patch
@@ -1,7 +1,7 @@
-From e3fd6c6b40fbd061490a9efbf9947f3c14bcc6ca Mon Sep 17 00:00:00 2001
+From 048153101214b5daa9f5b717f1b2bf9d3d1c93e6 Mon Sep 17 00:00:00 2001
 From: Todd Zullinger <tmz at pobox.com>
 Date: Sun, 28 Apr 2013 19:01:08 -0700
-Subject: [PATCH 7/7] Add condrestart/try-restart target to initscript
+Subject: [PATCH 7/8] Add condrestart/try-restart target to initscript
 
 The spec file calls this in %postun.  It simply fails but the error
 output is eaten by the redirection to /dev/null.
@@ -10,7 +10,7 @@ output is eaten by the redirection to /dev/null.
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/init-script.in b/init-script.in
-index ed6c366..96e17a7 100755
+index ed6c366..96e17a7 100644
 --- a/init-script.in
 +++ b/init-script.in
 @@ -66,12 +66,17 @@ case "$1" in
@@ -33,5 +33,5 @@ index ed6c366..96e17a7 100755
  esac
  
 -- 
-1.8.2.1
+1.8.3.1
 
diff --git a/nrpe-0008-Allow-user-to-override-all-defaults-even-command-def.patch b/nrpe-0008-Allow-user-to-override-all-defaults-even-command-def.patch
new file mode 100644
index 0000000..7c98473
--- /dev/null
+++ b/nrpe-0008-Allow-user-to-override-all-defaults-even-command-def.patch
@@ -0,0 +1,45 @@
+From 7fad8bf3b07257c4507f5abe207e707525ec9432 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Wed, 16 Oct 2013 17:34:41 +0400
+Subject: [PATCH 8/8] Allow user to override all defaults (even command
+ definitions)
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ sample-config/nrpe.cfg.in | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/sample-config/nrpe.cfg.in b/sample-config/nrpe.cfg.in
+index 20eb927..38fa875 100644
+--- a/sample-config/nrpe.cfg.in
++++ b/sample-config/nrpe.cfg.in
+@@ -185,14 +185,6 @@ connection_timeout=300
+ 
+ 
+ 
+-# INCLUDE CONFIG DIRECTORY
+-# This directive allows you to include definitions from config files (with a
+-# .cfg extension) in one or more directories (with recursion).
+-
+-include_dir=/etc/nrpe.d/
+-
+-
+-
+ # COMMAND DEFINITIONS
+ # Command definitions that this daemon will run.  Definitions
+ # are in the following format:
+@@ -232,3 +224,11 @@ command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200
+ #command[check_load]=@libexecdir@/check_load -w $ARG1$ -c $ARG2$
+ #command[check_disk]=@libexecdir@/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
+ #command[check_procs]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
++
++
++
++# INCLUDE CONFIG DIRECTORY
++# This directive allows you to include definitions from config files (with a
++# .cfg extension) in one or more directories (with recursion).
++
++include_dir=/etc/nrpe.d/
+-- 
+1.8.3.1
+
diff --git a/nrpe.spec b/nrpe.spec
index 99ac6ea..6bbe376 100644
--- a/nrpe.spec
+++ b/nrpe.spec
@@ -5,7 +5,7 @@
 
 Name: nrpe
 Version: 2.14
-Release: 4%{?dist}
+Release: 5%{?dist}
 Summary: Host/service/network monitoring agent for Nagios
 
 Group: Applications/System
@@ -22,9 +22,14 @@ Patch4: nrpe-0004-Fix-initscript-return-codes.patch
 Patch5: nrpe-0005-Do-not-start-by-default.patch
 Patch6: nrpe-0006-Relocate-pid-file.patch
 Patch7: nrpe-0007-Add-condrestart-try-restart-target-to-initscript.patch
+Patch8:	nrpe-0008-Allow-user-to-override-all-defaults-even-command-def.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+# For reconfiguration
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
 BuildRequires: openssl-devel
 # OpenSSL package was split into openssl and openssl-libs in F18+
 BuildRequires: openssl
@@ -40,15 +45,15 @@ BuildRequires: tcp_wrappers-devel
 
 Requires(pre): %{_sbindir}/useradd
 
-%if 0%{?fedora} > 17 || 0%{?rhel} > 6
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
-%else
+%if 0%{?el4}%{?el5}%{?el6}
 Requires(preun): /sbin/service, /sbin/chkconfig
 Requires(post): /sbin/chkconfig, /sbin/service
 Requires(postun): /sbin/service
 Requires: initscripts
+%else
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 %endif
 
 # owns /etc/nagios
@@ -88,6 +93,15 @@ This package provides the nrpe plugin for Nagios-related applications.
 %patch5 -p1 -b .do_not_start_by_default
 %patch6 -p1 -b .relocate_pid
 %patch7 -p1 -b .condrestart
+%patch8 -p1 -b .allow_override
+# Allow building for aarch64
+# https://bugzilla.redhat.com/926244
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+mv config.sub config.sub.old
+mv config.guess config.guess.old
+cp /usr/share/libtool/config/config.guess .
+cp /usr/share/libtool/config/config.sub .
+%endif
 
 %build
 CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%{?__global_ldflags}" \
@@ -107,10 +121,10 @@ make %{?_smp_mflags} all
 
 %install
 rm -rf %{buildroot}
-%if 0%{?fedora} > 17 || 0%{?rhel} > 6
-install -D -m 0644 -p %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
-%else
+%if 0%{?el4}%{?el5}%{?el6}
 install -D -p -m 0755 init-script %{buildroot}/%{_initrddir}/nrpe
+%else
+install -D -m 0644 -p %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
 %endif
 install -D -p -m 0644 sample-config/nrpe.cfg %{buildroot}/%{_sysconfdir}/nagios/%{name}.cfg
 install -D -p -m 0755 src/nrpe %{buildroot}/%{_sbindir}/nrpe
@@ -119,7 +133,7 @@ install -D -p -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
 install -d %{buildroot}%{_sysconfdir}/nrpe.d
 install -d %{buildroot}%{_localstatedir}/run/%{name}
 %if 0%{?fedora} > 14 || 0%{?rhel} > 6
-install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
+install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
 %endif
 
 
@@ -132,53 +146,56 @@ getent passwd %{name} >/dev/null || \
 %{_sbindir}/useradd -c "NRPE user for the NRPE service" -d %{_localstatedir}/run/%{name} -r -g %{name} -s /sbin/nologin %{name} 2> /dev/null || :
 
 %preun
-%if 0%{?fedora} > 17 || 0%{?rhel} > 6
-%systemd_preun nrpe.service
-%else
+%if 0%{?el4}%{?el5}%{?el6}
 if [ $1 = 0 ]; then
 	/sbin/service %{name} stop > /dev/null 2>&1 || :
 	/sbin/chkconfig --del %{name} || :
 fi
+%else
+%systemd_preun nrpe.service
 %endif
 
 %post
-%if 0%{?fedora} > 17 || 0%{?rhel} > 6
-%systemd_post nrpe.service
-%else
+%if 0%{?el4}%{?el5}%{?el6}
 /sbin/chkconfig --add %{name} || :
+%else
+%systemd_post nrpe.service
 %endif
 
 %postun
-%if 0%{?fedora} > 17 || 0%{?rhel} > 6
-%systemd_postun_with_restart nrpe.service 
-%else
+%if 0%{?el4}%{?el5}%{?el6}
 if [ "$1" -ge "1" ]; then
 	/sbin/service %{name} condrestart > /dev/null 2>&1 || :
 fi
+%else
+%systemd_postun_with_restart nrpe.service
 %endif
 
 %files
-%if 0%{?fedora} > 17 || 0%{?rhel} > 6
-%{_unitdir}/%{name}.service
-%else
+%if 0%{?el4}%{?el5}%{?el6}
 %{_initrddir}/nrpe
+%else
+%{_unitdir}/%{name}.service
 %endif
 %{_sbindir}/nrpe
 %dir %{_sysconfdir}/nrpe.d
 %config(noreplace) %{_sysconfdir}/nagios/nrpe.cfg
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
 %if 0%{?fedora} > 14 || 0%{?rhel} > 6
-%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
+%config(noreplace) %{_tmpfilesdir}/%{name}.conf
 %endif
 %doc Changelog LEGAL README README.SSL SECURITY docs/NRPE.pdf
 %dir %attr(775, %{name}, %{name}) %{_localstatedir}/run/%{name}
 
 %files -n nagios-plugins-nrpe
-%defattr(-,root,root,-)
 %{_libdir}/nagios/plugins/check_nrpe
 %doc Changelog LEGAL README
 
 %changelog
+* Wed Oct 16 2013 Peter Lemenkov <lemenkov at gmail.com> - 2.14-5
+- Allow building for aarch64 (rhbz #926244)
+- Allow user to redefine default commands (rhbz #963703)
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.14-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
@@ -244,7 +261,7 @@ fi
 * Wed Feb 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.12-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 
-* Sun Feb 21 2009 Mike McGrath <mmcgrath at redhat.com> - 2.12-7
+* Sat Feb 21 2009 Mike McGrath <mmcgrath at redhat.com> - 2.12-7
 - Re-fix for 477527
 
 * Mon Feb  2 2009 Peter Lemenkov <lemenkov at gmail.com> - 2.12-6
@@ -286,7 +303,7 @@ fi
 * Mon Jul 03 2006 Mike McGrath <imlinux at gmail.com> 2.5.2-1
 - Upstream released new version
 
-* Mon Mar 12 2006 Mike McGrath <imlinux at gmail.com> 2.4-3
+* Sun Mar 12 2006 Mike McGrath <imlinux at gmail.com> 2.4-3
 - Added description to useradd statement
 
 * Sun Mar 05 2006 Mike McGrath <imlinux at gmail.com> 2.4-2


More information about the scm-commits mailing list