nagios-plugins.spec.in 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # Macros
  2. %define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0")
  3. %define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0")
  4. %define isredhatfamily %(test -f /etc/redhat-release && echo "1" || echo "0")
  5. %if %{isaix}
  6. %define _prefix /opt/nagios
  7. # %define _defaultdocdir %{_datadir}/doc
  8. %else
  9. %define _libexecdir %{_exec_prefix}/lib/nagios/plugins
  10. %endif
  11. %define _sysconfdir /etc/nagios
  12. %define npusr nagios
  13. %define nphome /opt/nagios
  14. %define npgrp nagios
  15. Name: nagios-plugins
  16. Version: @PACKAGE_VERSION@
  17. Release: @RELEASE@
  18. Summary: Host/service/network monitoring program plugins for Nagios
  19. Group: Applications/System
  20. License: GPL
  21. URL: https://www.nagios-plugins.org/
  22. Source0: https://www.nagios-plugins.org/download/%{name}-%{version}.tar.gz
  23. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  24. %define npdir %{_builddir}/%{name}-%{version}
  25. %if %{isaix}
  26. Prefix: %{_prefix}
  27. %else
  28. Prefix: %{_prefix}/lib/nagios/plugins
  29. %endif
  30. Packager: Karl DeBisschop <kdebisschop@users.sourceforge.net>
  31. Vendor: Nagios Plugin Development Group
  32. Provides: nagios-plugins
  33. %{!?custom:%global custom 0}
  34. Obsoletes: nagios-plugins-custom nagios-plugins-extras
  35. # Requires
  36. %if %{isaix}
  37. Requires: fping
  38. Requires: gawk
  39. Requires: net-snmp
  40. Requires: net-snmp-perl
  41. Requires: net-snmp-utils
  42. Requires: openldap
  43. Requires: openssl
  44. Requires: perl
  45. Requires: python
  46. Requires: openssl
  47. BuildRequires: fping
  48. BuildRequires: gawk
  49. BuildRequires: net-snmp
  50. BuildRequires: net-snmp-perl
  51. BuildRequires: net-snmp-utils
  52. BuildRequires: openldap-devel
  53. %endif
  54. %if %{isredhatfamily}
  55. Requires: bind-utils
  56. Requires: coreutils
  57. Requires: fping
  58. Requires: gawk
  59. Requires: grep
  60. Requires: iputils
  61. Requires: mysql
  62. Requires: net-snmp-utils
  63. Requires: ntp
  64. Requires: openldap
  65. Requires: openssl
  66. Requires: openssh-clients
  67. Requires: perl
  68. Requires: postgresql-libs
  69. Requires: procps
  70. Requires: python
  71. Requires: samba-client
  72. Requires: shadow-utils
  73. Requires: traceroute
  74. Requires: /usr/bin/mailq
  75. BuildRequires: bind-utils
  76. BuildRequires: coreutils
  77. BuildRequires: iputils
  78. BuildRequires: mysql-devel
  79. BuildRequires: net-snmp-utils
  80. BuildRequires: net-tools
  81. BuildRequires: ntp
  82. BuildRequires: openldap-devel
  83. BuildRequires: openssh-clients
  84. BuildRequires: openssl-devel
  85. BuildRequires: postgresql-devel
  86. BuildRequires: procps
  87. BuildRequires: samba-client
  88. BuildRequires: /usr/bin/mailq
  89. %endif
  90. %description
  91. Nagios is a program that will monitor hosts and services on your
  92. network, and to email or page you when a problem arises or is
  93. resolved. Nagios runs on a unix server as a background or daemon
  94. process, intermittently running checks on various services that you
  95. specify. The actual service checks are performed by separate "plugin"
  96. programs which return the status of the checks to Nagios. This package
  97. contains those plugins.
  98. %prep
  99. %setup -q
  100. %build
  101. %{?isaix: MAKE=gmake} ./configure \
  102. --prefix=%{_prefix} \
  103. --exec-prefix=%{_exec_prefix} \
  104. --libexecdir=%{_libexecdir} \
  105. --sysconfdir=%{_sysconfdir} \
  106. --datadir=%{_datadir} \
  107. --with-cgiurl=/nagios/cgi-bin
  108. ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-before
  109. ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-before
  110. ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-before
  111. make %{?_smp_mflags}
  112. ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-after
  113. ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-after
  114. ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-after
  115. %pre
  116. # Create `nagios' group on the system if necessary
  117. %if %{isaix}
  118. lsgroup %{npgrp} > /dev/null 2> /dev/null
  119. if [ $? -eq 2 ] ; then
  120. mkgroup %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process.
  121. fi
  122. %endif
  123. %if %{islinux}
  124. getent group %{npgrp} > /dev/null 2> /dev/null
  125. if [ $? -ne 0 ] ; then
  126. groupadd %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process.
  127. fi
  128. %endif
  129. # Create `nagios' user on the system if necessary
  130. %if %{isaix}
  131. lsuser %{npusr} > /dev/null 2> /dev/null
  132. if [ $? -eq 2 ] ; then
  133. useradd -d %{nphome} -c "%{npusr}" -g %{npgrp} %{npusr} || \
  134. %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process.
  135. fi
  136. %endif
  137. %if %{islinux}
  138. getent passwd %{npusr} > /dev/null 2> /dev/null
  139. if [ $? -ne 0 ] ; then
  140. useradd -r -d %{nshome} -c "%{npusr}" -g %{npgrp} %{npusr} || \
  141. %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process.
  142. fi
  143. %endif
  144. %install
  145. rm -rf $RPM_BUILD_ROOT
  146. make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install
  147. build-aux/install-sh -c -d ${RPM_BUILD_ROOT}%{_sysconfdir}
  148. build-aux/install-sh -c -m 664 command.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}
  149. %find_lang %{name}
  150. echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
  151. comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
  152. echo "%defattr(755,root,root)" >> %{name}.lang
  153. comm -13 %{npdir}/ls-plugins-root-before %{npdir}/ls-plugins-root-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
  154. echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
  155. comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
  156. echo "%{_libexecdir}/utils.pm" >> %{name}.lang
  157. echo "%{_libexecdir}/utils.sh" >> %{name}.lang
  158. %clean
  159. rm -rf $RPM_BUILD_ROOT
  160. %files -f %{name}.lang
  161. %config(missingok,noreplace) %{_sysconfdir}/command.cfg
  162. %doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
  163. %doc ChangeLog command.cfg
  164. %if ! %{isaix}
  165. %{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
  166. %{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
  167. %endif
  168. %changelog
  169. * Mon May 23 2005 Sean Finney <seanius@seanius.net> - cvs head
  170. - just include the nagios plugins directory, which will automatically include
  171. all generated plugins (which keeps the build from failing on systems that
  172. don't have all build-dependencies for every plugin)
  173. * Tue Mar 04 2004 Karl DeBisschop <karl[AT]debisschop.net> - 1.4.0alpha1
  174. - extensive rewrite to facilitate processing into various distro-compatible specs
  175. * Tue Mar 04 2004 Karl DeBisschop <karl[AT]debisschop.net> - 1.4.0alpha1
  176. - extensive rewrite to facilitate processing into various distro-compatible specs