[nagios] Added systemd support

Peter Lemenkov peter at fedoraproject.org
Sat Oct 19 15:56:05 UTC 2013


commit 723102ae136e02d0be9e60f26b54796c36b445d0
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Sat Oct 19 19:54:36 2013 +0400

    Added systemd support
    
    - Added systemd support (rhbz #913550, also obsoletes rhbz #246990)
    - Drop EL5 support
    - Replace config.sub and config.guess instead of patching them
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 nagios-0001-from-rpm.patch                         |   21 +-
 nagios-0002-SELinux-relabeling.patch               |   23 +-
 nagios-0003-Fix-etc-init.d-nagios-status.patch     |   16 +-
 ...-installation-of-httpd-conf.d-config-file.patch |   14 +-
 nagios-0005-Install-config-files-too.patch         |   14 +-
 nagios-0006-Do-not-start-service-by-default.patch  |   12 +-
 ...ript-should-return-2-in-case-of-unknown-c.patch |   15 +-
 nagios-0008-Fix-path-to-CGI-executables.patch      |   10 +-
 ...th-to-passwd-file-in-Apache-s-config-file.patch |   10 +-
 ...-several-images-to-the-sample-config-revb.patch |   28 +-
 ...Added-several-images-to-the-sample-config.patch |  169 -
 ...pache-2.4-configuration-fix-for-Fedora-18.patch |   24 +-
 nagios-0011-Fixed-strange-permissions.patch        |   35 -
 ...-etc-nagios-conf.d-to-the-main-nagios-con.patch |   26 +
 nagios-0012-add-aarch64-support.patch              | 4318 --------------------
 nagios-3.4.3-spaces-to-plus-signs.patch            |   11 -
 nagios-3.5.0-conf.d-configuration-directory.patch  |   12 -
 nagios.service                                     |   15 +
 nagios.spec                                        |   97 +-
 nagios.tmpfiles.conf                               |    1 +
 20 files changed, 238 insertions(+), 4633 deletions(-)
---
diff --git a/nagios-0001-from-rpm.patch b/nagios-0001-from-rpm.patch
index ad9fe44..e4da747 100644
--- a/nagios-0001-from-rpm.patch
+++ b/nagios-0001-from-rpm.patch
@@ -1,7 +1,17 @@
-diff -ruN nagios/daemon-init.in nagios-modified/daemon-init.in
---- nagios/daemon-init.in	2010-10-23 10:59:18.000000000 +0100
-+++ nagios-modified/daemon-init.in	2013-08-29 03:19:07.501259965 +0100
-@@ -129,7 +129,8 @@
+From 9ed79b08e60f933d59941cceb6c542c9cf8a9648 Mon Sep 17 00:00:00 2001
+From: Mike McGrath <mmcgrath at redhat.com>
+Date: Thu, 25 Feb 2010 14:21:30 +0300
+Subject: [PATCH 01/12] from rpm
+
+---
+ daemon-init.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/daemon-init.in b/daemon-init.in
+index 98f35e5..057424b 100644
+--- a/daemon-init.in
++++ b/daemon-init.in
+@@ -129,7 +129,8 @@ case "$1" in
  		echo -n "Starting nagios:"
  		$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
  		if [ $? -eq 0 ]; then
@@ -11,3 +21,6 @@ diff -ruN nagios/daemon-init.in nagios-modified/daemon-init.in
  			rm -f $NagiosCommandFile
  			touch $NagiosRunFile
  			chown $NagiosUser:$NagiosGroup $NagiosRunFile
+-- 
+1.8.3.1
+
diff --git a/nagios-0002-SELinux-relabeling.patch b/nagios-0002-SELinux-relabeling.patch
index 1fa4dd7..49d9dc7 100644
--- a/nagios-0002-SELinux-relabeling.patch
+++ b/nagios-0002-SELinux-relabeling.patch
@@ -1,7 +1,19 @@
-diff -ruN nagios/daemon-init.in nagios-modified/daemon-init.in
---- nagios/daemon-init.in	2013-08-29 03:19:07.501259965 +0100
-+++ nagios-modified/daemon-init.in	2013-08-29 03:20:36.733259743 +0100
-@@ -134,6 +134,7 @@
+From 084540360bfc7de9cdf8e73f242d178eb9f7c9c7 Mon Sep 17 00:00:00 2001
+From: Daniel Walsh <dwalsh at redhat.com>
+Date: Thu, 25 Feb 2010 14:24:00 +0300
+Subject: [PATCH 02/12] SELinux relabeling
+
+This patch adds a restorecon call to the init script to label the pid file
+correctly.
+---
+ daemon-init.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/daemon-init.in b/daemon-init.in
+index 057424b..c17b30c 100644
+--- a/daemon-init.in
++++ b/daemon-init.in
+@@ -134,6 +134,7 @@ case "$1" in
  			rm -f $NagiosCommandFile
  			touch $NagiosRunFile
  			chown $NagiosUser:$NagiosGroup $NagiosRunFile
@@ -9,3 +21,6 @@ diff -ruN nagios/daemon-init.in nagios-modified/daemon-init.in
  			$NagiosBin -d $NagiosCfgFile
  			if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi
  			echo " done."
+-- 
+1.8.3.1
+
diff --git a/nagios-0003-Fix-etc-init.d-nagios-status.patch b/nagios-0003-Fix-etc-init.d-nagios-status.patch
index cbed5e9..9e7b157 100644
--- a/nagios-0003-Fix-etc-init.d-nagios-status.patch
+++ b/nagios-0003-Fix-etc-init.d-nagios-status.patch
@@ -1,18 +1,18 @@
-From adc53e77fd938fe350b0a7c3c9a24470679a6134 Mon Sep 17 00:00:00 2001
+From 354b8e7a85db2a6e1bdd50ec24856a2a6108fd0c Mon Sep 17 00:00:00 2001
 From: Ricky Zhou <rzhou at redhat.com>
 Date: Thu, 25 Feb 2010 14:27:08 +0300
-Subject: [PATCH 03/11] Fix /etc/init.d/nagios status
+Subject: [PATCH 03/12] Fix /etc/init.d/nagios status
 
 Fix status return code.
 ---
- daemon-init.in |    7 +++++--
- 1 files changed, 5 insertions(+), 2 deletions(-)
+ daemon-init.in | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
 
 diff --git a/daemon-init.in b/daemon-init.in
-index 75aa0b3..ecd072a 100644
+index c17b30c..baf4d6b 100644
 --- a/daemon-init.in
 +++ b/daemon-init.in
-@@ -52,12 +52,14 @@ status_nagios ()
+@@ -57,12 +57,14 @@ status_nagios ()
  
  printstatus_nagios()
  {
@@ -29,7 +29,7 @@ index 75aa0b3..ecd072a 100644
  }
  
  
-@@ -174,6 +176,7 @@ case "$1" in
+@@ -178,6 +180,7 @@ case "$1" in
  	status)
  		pid_nagios
  		printstatus_nagios nagios
@@ -38,5 +38,5 @@ index 75aa0b3..ecd072a 100644
  
  	checkconfig)
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0004-Fix-installation-of-httpd-conf.d-config-file.patch b/nagios-0004-Fix-installation-of-httpd-conf.d-config-file.patch
index 76958af..8cd8acf 100644
--- a/nagios-0004-Fix-installation-of-httpd-conf.d-config-file.patch
+++ b/nagios-0004-Fix-installation-of-httpd-conf.d-config-file.patch
@@ -1,18 +1,18 @@
-From e35cd91bdb0cd3b7c1adfa942491778c3ba97b79 Mon Sep 17 00:00:00 2001
+From 78e531097a6461abd3e0d386cbdf79be6c15c4ac Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Thu, 23 Sep 2010 18:46:50 +0400
-Subject: [PATCH 04/11] Fix installation of httpd/conf.d config-file
+Subject: [PATCH 04/12] Fix installation of httpd/conf.d config-file
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
- Makefile.in |    1 +
- 1 files changed, 1 insertions(+), 0 deletions(-)
+ Makefile.in | 1 +
+ 1 file changed, 1 insertion(+)
 
 diff --git a/Makefile.in b/Makefile.in
-index a7f77ca..c6e823d 100644
+index 5cc7f81..588109e 100644
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -264,6 +264,7 @@ install-config:
+@@ -284,6 +284,7 @@ install-config:
  	@echo ""
  
  install-webconf:
@@ -21,5 +21,5 @@ index a7f77ca..c6e823d 100644
  
  	@echo ""
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0005-Install-config-files-too.patch b/nagios-0005-Install-config-files-too.patch
index dcb2d6c..a7e1532 100644
--- a/nagios-0005-Install-config-files-too.patch
+++ b/nagios-0005-Install-config-files-too.patch
@@ -1,18 +1,18 @@
-From e0ddbf70a34c00f05d392bb85415163946623d63 Mon Sep 17 00:00:00 2001
+From e0328ca7fa6d39ca5e728798375c91a2ffe7b157 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Thu, 23 Sep 2010 21:21:28 +0400
-Subject: [PATCH 05/11] Install config-files too
+Subject: [PATCH 05/12] Install config-files too
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
- Makefile.in |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Makefile.in b/Makefile.in
-index c6e823d..801a6fd 100644
+index 588109e..df4d450 100644
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -291,7 +291,7 @@ install-commandmode:
+@@ -329,7 +329,7 @@ install-commandmode:
  	@echo ""
  
  
@@ -22,5 +22,5 @@ index c6e823d..801a6fd 100644
  # Uninstall is too destructive if base install directory is /usr, etc.
  #uninstall:
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0006-Do-not-start-service-by-default.patch b/nagios-0006-Do-not-start-service-by-default.patch
index fffb284..9346006 100644
--- a/nagios-0006-Do-not-start-service-by-default.patch
+++ b/nagios-0006-Do-not-start-service-by-default.patch
@@ -1,15 +1,15 @@
-From 53ad344a9df8af8c3d59d0b4127201e6f1d19277 Mon Sep 17 00:00:00 2001
+From 7472d8289ec9895217d418dd0d6c10e224f6a818 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Thu, 23 Sep 2010 22:32:46 +0400
-Subject: [PATCH 06/11] Do not start service by default
+Subject: [PATCH 06/12] Do not start service by default
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
- daemon-init.in |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ daemon-init.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/daemon-init.in b/daemon-init.in
-index ecd072a..5e52637 100644
+index baf4d6b..8d460d4 100644
 --- a/daemon-init.in
 +++ b/daemon-init.in
 @@ -1,6 +1,6 @@
@@ -21,5 +21,5 @@ index ecd072a..5e52637 100644
  #
  # File : nagios
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0007-The-init-script-should-return-2-in-case-of-unknown-c.patch b/nagios-0007-The-init-script-should-return-2-in-case-of-unknown-c.patch
index e07aa18..0c09319 100644
--- a/nagios-0007-The-init-script-should-return-2-in-case-of-unknown-c.patch
+++ b/nagios-0007-The-init-script-should-return-2-in-case-of-unknown-c.patch
@@ -1,18 +1,19 @@
-From be1a5ac3efb5a443c82cbd3ee2e0656d2e7aca52 Mon Sep 17 00:00:00 2001
+From 76562a0ebdba0c0d78ca3800f059cc5625b01a74 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 24 Sep 2010 14:20:54 +0400
-Subject: [PATCH 07/11] The init-script should return 2 in case of unknown command.
+Subject: [PATCH 07/12] The init-script should return 2 in case of unknown
+ command.
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
- daemon-init.in |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ daemon-init.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/daemon-init.in b/daemon-init.in
-index 5e52637..16b98be 100644
+index 8d460d4..57b1a86 100644
 --- a/daemon-init.in
 +++ b/daemon-init.in
-@@ -229,7 +229,7 @@ case "$1" in
+@@ -233,7 +233,7 @@ case "$1" in
  
  	*)
  		echo "Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig}"
@@ -22,5 +23,5 @@ index 5e52637..16b98be 100644
  
  esac
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0008-Fix-path-to-CGI-executables.patch b/nagios-0008-Fix-path-to-CGI-executables.patch
index 2a7d37d..83fd09f 100644
--- a/nagios-0008-Fix-path-to-CGI-executables.patch
+++ b/nagios-0008-Fix-path-to-CGI-executables.patch
@@ -1,7 +1,7 @@
-From 6b4fb54ca91a4c1954da50cb05956c8ec0e0acd0 Mon Sep 17 00:00:00 2001
+From 3bdd7e40e1c7e7484edcb53b01ef3cd446305466 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Mon, 15 Nov 2010 15:07:49 +0300
-Subject: [PATCH 08/11] Fix path to CGI executables
+Subject: [PATCH 08/12] Fix path to CGI executables
 
 See rhbz #653291 for additional details:
 
@@ -9,8 +9,8 @@ https://bugzilla.redhat.com/653291
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
- sample-config/httpd.conf.in |    4 ++--
- subst.in                    |    1 +
+ sample-config/httpd.conf.in | 4 ++--
+ subst.in                    | 1 +
  2 files changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/sample-config/httpd.conf.in b/sample-config/httpd.conf.in
@@ -42,5 +42,5 @@ index a8e2c06..bbffb3a 100755
  		s|\@cgiurl\@|@cgiurl@|g;
  		s|\@MAIL_PROG\@|@MAIL_PROG@|g;
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0009-Fixed-path-to-passwd-file-in-Apache-s-config-file.patch b/nagios-0009-Fixed-path-to-passwd-file-in-Apache-s-config-file.patch
index 799cda1..81d85c8 100644
--- a/nagios-0009-Fixed-path-to-passwd-file-in-Apache-s-config-file.patch
+++ b/nagios-0009-Fixed-path-to-passwd-file-in-Apache-s-config-file.patch
@@ -1,11 +1,11 @@
-From b8c27bebfad2feccfe8b2c375f702502f0bc6048 Mon Sep 17 00:00:00 2001
+From e4a68149eacd8361777ba1219013ce3cb2c6e3ea Mon Sep 17 00:00:00 2001
 From: Davide Madrisan <davide.madrisan at gmail.com>
 Date: Thu, 18 Nov 2010 18:57:14 +0300
-Subject: [PATCH 09/11] Fixed path to passwd file in Apache's config file
+Subject: [PATCH 09/12] Fixed path to passwd file in Apache's config file
 
 ---
- sample-config/httpd.conf.in |    4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
+ sample-config/httpd.conf.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/sample-config/httpd.conf.in b/sample-config/httpd.conf.in
 index 1b1e693..0a32781 100644
@@ -30,5 +30,5 @@ index 1b1e693..0a32781 100644
  </Directory>
  
 -- 
-1.7.3.5
+1.8.3.1
 
diff --git a/nagios-0010-Added-several-images-to-the-sample-config-revb.patch b/nagios-0010-Added-several-images-to-the-sample-config-revb.patch
index e141284..a47400c 100644
--- a/nagios-0010-Added-several-images-to-the-sample-config-revb.patch
+++ b/nagios-0010-Added-several-images-to-the-sample-config-revb.patch
@@ -1,6 +1,23 @@
---- nagios-3.4.4/sample-config/template-object/templates.cfg.in	2007-10-03 22:43:14.000000000 +0100
-+++ nagios-3.4.4-modified/sample-config/template-object/templates.cfg.in	2013-01-13 03:12:00.791398046 +0000
-@@ -117,6 +117,7 @@
+From 539ef04ad938d9cb282c8c98fc827454dadfcf56 Mon Sep 17 00:00:00 2001
+From: Peter Astakhov <astakhovp at yarbroiler.ru>
+Date: Tue, 23 Nov 2010 14:02:28 +0300
+Subject: [PATCH 10/12] Added several images to the sample config
+
+---
+ html/images/logos/printer.png                  | Bin 0 -> 1649 bytes
+ html/images/logos/router.png                   | Bin 0 -> 2079 bytes
+ html/images/logos/switch.png                   | Bin 0 -> 1181 bytes
+ sample-config/template-object/templates.cfg.in |  10 ++++++++++
+ 4 files changed, 10 insertions(+)
+ create mode 100644 html/images/logos/printer.png
+ create mode 100644 html/images/logos/router.png
+ create mode 100644 html/images/logos/switch.png
+
+diff --git a/sample-config/template-object/templates.cfg.in b/sample-config/template-object/templates.cfg.in
+index 16a980d..97e4f0f 100644
+--- a/sample-config/template-object/templates.cfg.in
++++ b/sample-config/template-object/templates.cfg.in
+@@ -117,6 +117,7 @@ define host{
  	notification_interval	30		; Resend notifications every 30 minutes
  	notification_options	d,r		; Only send notifications for specific host states
  	contact_groups		admins		; Notifications get sent to the admins by default
@@ -8,7 +25,7 @@
  	register		0		; DONT REGISTER THIS - ITS JUST A TEMPLATE
  	}
  
-@@ -134,6 +135,15 @@
+@@ -134,6 +135,15 @@ define host{
  	notification_interval	30		; Resend notifications every 30 minutes
  	notification_options	d,r		; Only send notifications for specific host states
  	contact_groups		admins		; Notifications get sent to the admins by default
@@ -24,3 +41,6 @@
  	register		0		; DONT REGISTER THIS - ITS JUST A TEMPLATE
  	}
  
+-- 
+1.8.3.1
+
diff --git a/nagios-3.4.3-httpd-2.4-and-2.2.patch b/nagios-0011-Apache-2.4-configuration-fix-for-Fedora-18.patch
similarity index 67%
rename from nagios-3.4.3-httpd-2.4-and-2.2.patch
rename to nagios-0011-Apache-2.4-configuration-fix-for-Fedora-18.patch
index 5da5aa4..c2616a0 100644
--- a/nagios-3.4.3-httpd-2.4-and-2.2.patch
+++ b/nagios-0011-Apache-2.4-configuration-fix-for-Fedora-18.patch
@@ -1,7 +1,18 @@
-diff -ruN nagios/sample-config/httpd.conf.in nagios-modified/sample-config/httpd.conf.in
---- nagios/sample-config/httpd.conf.in	2012-12-05 13:07:31.076014408 +0000
-+++ nagios-modified/sample-config/httpd.conf.in	2012-12-05 13:10:07.261019793 +0000
-@@ -12,15 +12,28 @@
+From 7443b795cff3261dcd793dfb8aaaeab688eaa383 Mon Sep 17 00:00:00 2001
+From: Jose Pedro Oliveira <jpo at di.uminho.pt>
+Date: Wed, 5 Dec 2012 00:20:21 +0000
+Subject: [PATCH 11/12] Apache 2.4 configuration fix for Fedora 18+
+
+Also use the Apache 2.4 RequireAll authorization container.
+---
+ sample-config/httpd.conf.in | 50 ++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 38 insertions(+), 12 deletions(-)
+
+diff --git a/sample-config/httpd.conf.in b/sample-config/httpd.conf.in
+index 0a32781..6728034 100644
+--- a/sample-config/httpd.conf.in
++++ b/sample-config/httpd.conf.in
+@@ -12,15 +12,28 @@ ScriptAlias @cgiurl@ "@cgidir@"
  #  SSLRequireSSL
     Options ExecCGI
     AllowOverride None
@@ -36,7 +47,7 @@ diff -ruN nagios/sample-config/httpd.conf.in nagios-modified/sample-config/httpd
  </Directory>
  
  Alias @htmurl@ "@datadir@"
-@@ -29,14 +42,27 @@
+@@ -29,14 +42,27 @@ Alias @htmurl@ "@datadir@"
  #  SSLRequireSSL
     Options None
     AllowOverride None
@@ -70,3 +81,6 @@ diff -ruN nagios/sample-config/httpd.conf.in nagios-modified/sample-config/httpd
 +   </IfModule>
  </Directory>
  
+-- 
+1.8.3.1
+
diff --git a/nagios-0012-Add-cfg_dir-etc-nagios-conf.d-to-the-main-nagios-con.patch b/nagios-0012-Add-cfg_dir-etc-nagios-conf.d-to-the-main-nagios-con.patch
new file mode 100644
index 0000000..cfbaa99
--- /dev/null
+++ b/nagios-0012-Add-cfg_dir-etc-nagios-conf.d-to-the-main-nagios-con.patch
@@ -0,0 +1,26 @@
+From 8546f374d6aa544a44cf3d4b80bdf2a53aa05f60 Mon Sep 17 00:00:00 2001
+From: Jose Pedro Oliveira <jpo at di.uminho.pt>
+Date: Wed, 24 Apr 2013 02:07:54 +0100
+Subject: [PATCH 12/12] Add cfg_dir=/etc/nagios/conf.d to the main nagios
+ configuration file
+
+---
+ sample-config/nagios.cfg.in | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sample-config/nagios.cfg.in b/sample-config/nagios.cfg.in
+index 1c2718e..52e5b4d 100644
+--- a/sample-config/nagios.cfg.in
++++ b/sample-config/nagios.cfg.in
+@@ -54,6 +54,8 @@ cfg_file=@sysconfdir@/objects/localhost.cfg
+ #cfg_dir=@sysconfdir@/switches
+ #cfg_dir=@sysconfdir@/routers
+ 
++cfg_dir=@sysconfdir@/conf.d
++
+ 
+ 
+ 
+-- 
+1.8.3.1
+
diff --git a/nagios.service b/nagios.service
new file mode 100644
index 0000000..bd58b0f
--- /dev/null
+++ b/nagios.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Nagios Network Monitoring
+Documentation=http://www.nagios.org/documentation
+
+[Service]
+Type=simple
+User=nagios
+Group=nagios
+PIDFile=/var/run/nagios/nagios.pid
+# Verify Nagios config before start as upstream suggested
+ExecStarPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg
+ExecStart=/usr/sbin/nagios /etc/nagios/nagios.cfg
+
+[Install]
+WantedBy=multi-user.target
diff --git a/nagios.spec b/nagios.spec
index 5363a40..f06f7ce 100644
--- a/nagios.spec
+++ b/nagios.spec
@@ -2,7 +2,7 @@
 
 Name: nagios
 Version: 3.5.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: Host/service/network monitoring program
 
 Group: Applications/System
@@ -15,6 +15,8 @@ Source3: nagios.internet.cfg
 Source4: nagios.htpasswd
 Source5: nagios.upgrade_to_v3.ReadMe
 Source6: nagios.upgrade_to_v3.sh
+Source7: nagios.service
+Source8: nagios.tmpfiles.conf
 # PNG files from the old nagios-0010-Added-several-images-to-the-sample-config.patch
 Source10: printer.png
 Source11: router.png
@@ -33,24 +35,25 @@ Patch7: nagios-0007-The-init-script-should-return-2-in-case-of-unknown-c.patch
 Patch8: nagios-0008-Fix-path-to-CGI-executables.patch
 Patch9: nagios-0009-Fixed-path-to-passwd-file-in-Apache-s-config-file.patch
 Patch10: nagios-0010-Added-several-images-to-the-sample-config-revb.patch
-Patch11: nagios-0011-Fixed-strange-permissions.patch
-Patch12: nagios-3.4.3-httpd-2.4-and-2.2.patch
-Patch14: nagios-3.5.0-conf.d-configuration-directory.patch
-Patch15: nagios-0012-add-aarch64-support.patch
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch11: nagios-0011-Apache-2.4-configuration-fix-for-Fedora-18.patch
+Patch12: nagios-0012-Add-cfg_dir-etc-nagios-conf.d-to-the-main-nagios-con.patch
 
 BuildRequires: gd-devel > 1.8, mailx, libjpeg-devel, libpng-devel
 BuildRequires: perl(CPAN)
 BuildRequires: perl(ExtUtils::MakeMaker)
 BuildRequires: perl(ExtUtils::Embed)
 BuildRequires: perl(Test::Harness)
-%if 0%{?el6}%{?fedora}
 BuildRequires: perl(Test::HTML::Lint)
-%endif
 BuildRequires: perl(Test::More)
 BuildRequires: perl(Test::Simple)
 
+# For up-to-date config.sub and config.guess
+BuildRequires: libtool
+
+%if 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
+# For necessary macros
+BuildRequires: systemd
+%endif
 
 Requires: httpd
 Requires: php
@@ -140,22 +143,24 @@ may compile against.
 %patch8 -p1 -b .fix_path_to_cgi
 %patch9 -p1 -b .fix_path_to_passwd
 %patch10 -p1 -b .more_images
-%patch11 -p1 -b .fix_perms
-%patch12 -p1 -b .httpd_conf
-%patch14 -p1 -b .conf_d
-%patch15 -p1 
+%patch11 -p1 -b .httpd_conf
+%patch12 -p1 -b .conf_d
 
 install -p -m 0644 %{SOURCE10} %{SOURCE11} %{SOURCE12} html/images/logos/
 
 
 %build
+# Remove two autogenerated files to allow building on modern arches
+rm -f tap/config.guess tap/config.sub
+cp /usr/share/libtool/*/config.guess .
+cp /usr/share/libtool/*/config.sub .
 %configure \
     --prefix=%{_datadir}/%{name} \
     --exec-prefix=%{_localstatedir}/lib/%{name} \
     --with-init-dir=%{_initrddir} \
     --with-cgiurl=/%{name}/cgi-bin/ \
     --with-htmlurl=/%{name} \
-    --with-lockfile=%{_localstatedir}/run/%{name}.pid \
+    --with-lockfile=%{_localstatedir}/run/%{name}/%{name}.pid \
     --libdir=%{_libdir}/%{name} \
     --with-nagios-user=nagios \
     --with-nagios-grp=nagios \
@@ -185,7 +190,6 @@ echo >> html/stylesheets/common.css
 
 
 %install
-rm -rf %{buildroot}
 make DESTDIR=%{buildroot} INIT_OPTS="" INSTALL_OPTS="" COMMAND_OPTS="" CGIDIR="%{_libdir}/%{name}/cgi-bin" CFGDIR="%{_sysconfdir}/%{name}" fullinstall
 
 # relocated to sbin (Fedora-specific)
@@ -209,9 +213,13 @@ install -d -m 0755 %{buildroot}%{_libdir}/%{name}/plugins/eventhandlers
 
 install -d -m 0775 %{buildroot}%{_localstatedir}/spool/%{name}/cmd
 
-
-%clean
-rm -rf %{buildroot}
+%if 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
+# Install systemd entry
+install -D -m 0644 -p %{S:7} %{buildroot}%{_unitdir}/%{name}.service
+install -D -m 0644 -p %{S:8} %{buildroot}%{_tmpfilesdir}/%{name}.conf
+# Remove SystemV init-script
+rm -f %{buildroot}%{_initrddir}/nagios
+%endif
 
 
 %pre common
@@ -220,19 +228,33 @@ getent passwd nagios >/dev/null || useradd -r -g nagios -d %{_localstatedir}/spo
 exit 0
 
 
-%preun
-if [ $1 = 0 ]; then
-    /sbin/service nagios stop > /dev/null 2>&1 || :
-    /sbin/chkconfig --del %{name} || :
-fi
-
-
 %post
 %{_sbindir}/usermod -a -G %{name} apache || :
-/sbin/chkconfig --add %{name} || :
+
+%if 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
+%systemd_post %{name}.service
+%else
+if [ $1 -eq 1 ]; then
+	# Initial installation
+	/sbin/chkconfig --add %{name} || :
+fi
+%endif
+
 /sbin/service httpd condrestart > /dev/null 2>&1 || :
 
 
+%preun
+%if 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
+%systemd_preun %{name}.service
+%else
+if [ $1 -eq 0 ]; then
+	# Package removal, not upgrade
+        /sbin/service %{name} stop >/dev/null 2>&1 || :
+        /sbin/chkconfig --del %{name} || :
+fi
+%endif
+
+
 %postun
 /sbin/service httpd condrestart > /dev/null 2>&1 || :
 
@@ -242,6 +264,19 @@ fi
 #make test
 
 
+%if 0%{?fedora} > 19
+%triggerun -- %{name} < 3.5.1-2
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply opensips
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
+/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+%endif
+
+
 %files
 %dir %{_libdir}/%{name}/plugins/eventhandlers
 %dir %{_libdir}/%{name}/cgi-bin
@@ -254,7 +289,12 @@ fi
 %{_sbindir}/*
 %{_bindir}/*
 %{_libdir}/%{name}/cgi-bin/*cgi
+%if 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
+%{_unitdir}/%{name}.service
+%{_tmpfilesdir}/%{name}.conf
+%else
 %{_initrddir}/nagios
+%endif
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/nagios.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
 %config(noreplace) %{_sysconfdir}/%{name}/*cfg
@@ -284,6 +324,11 @@ fi
 
 
 %changelog
+* Fri Oct 18 2013 Peter Lemenkov <lemenkov at gmail.com> - 3.5.1-2
+- Drop EL5 support
+- Added systemd support (rhbz #913550, also obsoletes rhbz #246990)
+- Replace config.sub and config.guess instead of patching them
+
 * Fri Aug 30 2013 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.5.1-1
 - update to 3.5.1
 - drop patch nagios-3.4.3-spaces-to-plus-signs.patch (upstream bug #407)
diff --git a/nagios.tmpfiles.conf b/nagios.tmpfiles.conf
new file mode 100644
index 0000000..907ca68
--- /dev/null
+++ b/nagios.tmpfiles.conf
@@ -0,0 +1 @@
+D /var/run/nagios 0755 nagios nagios -


More information about the scm-commits mailing list