nagios.spec 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. ##
  2. ## nagios.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: nagios
  27. Summary: System and Network Monitoring
  28. URL: http://www.nagios.org/
  29. Vendor: Ethan Galstad
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [EVAL]
  32. Group: Network
  33. License: GNU
  34. Version: 1.1
  35. Release: 20030708
  36. # package options
  37. %option with_fsl yes
  38. # list of sources
  39. Source0: http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz
  40. Source1: rc.nagios
  41. Source2: fsl.nagios
  42. Patch0: nagios.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20030415, traceroute, gcc
  47. PreReq: OpenPKG, openpkg >= 20030415, traceroute, apache
  48. BuildPreReq: gd, jpeg, png, zlib
  49. PreReq: gd, jpeg, png, zlib
  50. %if "%{with_fsl}" == "yes"
  51. BuildPreReq: fsl
  52. PreReq: fsl
  53. %endif
  54. AutoReq: no
  55. AutoReqProv: no
  56. %description
  57. Nagios is a system and network monitoring application. It watches
  58. hosts and services that you specify, alerting you when things go bad
  59. and when they get better.
  60. %prep
  61. %setup -q
  62. %patch -p0
  63. %build
  64. %{l_shtool} subst \
  65. -e 's;localstatedir=.\${prefix}/var.;localstatedir="'%{l_prefix}'/var/nagios";g' \
  66. -e 's;datadir=.\${prefix}/share.;datadir="'%{l_prefix}'/share/nagios";g' \
  67. -e 's;sysconfdir=.\${prefix}/etc.;sysconfdir="'%{l_prefix}'/etc/nagios";g' \
  68. -e 's;libexecdir=.\${prefix}/libexec.;libexecdir="'%{l_prefix}'/libexec/nagios";g' \
  69. configure
  70. %{l_shtool} subst \
  71. -e 's;log_file=.*;log_file=/dev/null;' \
  72. sample-config/nagios.cfg.in
  73. echo "ac_cv_path_PATH_TO_TRACEROUTE=%{l_prefix}/sbin/traceroute}" >config.cache
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O}" \
  76. LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  77. PERLLIBS="%{l_fsl_libs}" \
  78. ./configure \
  79. --prefix=%{l_prefix} \
  80. --with-cgiurl=%{l_prefix}/cgi/nagios \
  81. --with-htmurl=%{l_prefix}/share/nagios \
  82. --with-nagios-user=%{l_musr} \
  83. --with-nagios-grp=%{l_mgrp} \
  84. --with-gd-lib=%{l_prefix}/lib \
  85. --with-gd-inc=%{l_prefix}/include \
  86. --with-lockfile=%{l_prefix}/var/nagios/nagios.lock
  87. %{l_make} all %{l_mflags} \
  88. GDLIBS="-lgd -lm -lpng -lz -ljpeg" \
  89. LOGDIR=%{l_prefix}/var/nagios \
  90. CFGDIR=%{l_prefix}/etc/nagios \
  91. BINDIR=%{l__prefix}/bin \
  92. CGIDIR=%{l_prefix}/cgi/nagios \
  93. HTMLDIR=%{l_prefix}/share/nagios
  94. %install
  95. rm -rf $RPM_BUILD_ROOT
  96. %{l_shtool} mkdir -f -p -m 755 \
  97. $RPM_BUILD_ROOT%{l_prefix}/etc/nagios \
  98. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  99. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  100. $RPM_BUILD_ROOT%{l_prefix}/var/nagios/rw \
  101. $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios \
  102. $RPM_BUILD_ROOT%{l_prefix}/cgi/nagios \
  103. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/media \
  104. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/stylesheets \
  105. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/contexthelp \
  106. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/images \
  107. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/logos \
  108. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/ssi
  109. # install nagios
  110. %{l_shtool} install -c -s -m 755 \
  111. base/nagios $RPM_BUILD_ROOT%{l_prefix}/sbin/
  112. # install html
  113. %{l_shtool} install -c -m 644 \
  114. html/robots.txt $RPM_BUILD_ROOT%{l_prefix}/share/nagios/
  115. %{l_shtool} install -c -m 644 \
  116. html/docs/robots.txt $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/
  117. %{l_shtool} install -c -m 644 \
  118. html/media/*.wav $RPM_BUILD_ROOT%{l_prefix}/share/nagios/media/
  119. %{l_shtool} install -c -m 644 \
  120. html/stylesheets/*.css $RPM_BUILD_ROOT%{l_prefix}/share/nagios/stylesheets/
  121. %{l_shtool} install -c -m 644 \
  122. html/contexthelp/*.html $RPM_BUILD_ROOT%{l_prefix}/share/nagios/contexthelp/
  123. %{l_shtool} install -c -m 644 \
  124. html/docs/*.html $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/
  125. %{l_shtool} install -c -m 644 \
  126. html/docs/images/*.* $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/images/
  127. %{l_shtool} install -c -m 644 \
  128. html/images/*.gif html/images/*.jpg html/images/*.png \
  129. $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/
  130. %{l_shtool} install -c -m 644 \
  131. html/images/logos/*.* $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/logos/
  132. # install cgis
  133. %{l_shtool} install -c -s -m 755 \
  134. cgi/*.cgi $RPM_BUILD_ROOT%{l_prefix}/cgi/nagios/
  135. # install sample config
  136. %{l_shtool} install -c -m 644 \
  137. sample-config/nagios.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  138. %{l_shtool} install -c -m 644 \
  139. sample-config/cgi.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  140. %{l_shtool} install -c -m 644 \
  141. sample-config/resource.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  142. %{l_shtool} install -c -m 644 \
  143. sample-config/template-object/checkcommands.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  144. %{l_shtool} install -c -m 644 \
  145. sample-config/template-object/contactgroups.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  146. %{l_shtool} install -c -m 644 \
  147. sample-config/template-object/contacts.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  148. %{l_shtool} install -c -m 644 \
  149. /dev/null $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/dependencies.cfg
  150. %{l_shtool} install -c -m 644 \
  151. sample-config/template-object/escalations.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  152. %{l_shtool} install -c -m 644 \
  153. sample-config/template-object/hostgroups.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  154. %{l_shtool} install -c -m 644 \
  155. sample-config/template-object/hosts.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  156. %{l_shtool} install -c -m 644 \
  157. sample-config/template-object/misccommands.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  158. %{l_shtool} install -c -m 644 \
  159. sample-config/template-object/services.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  160. %{l_shtool} install -c -m 644 \
  161. sample-config/template-object/timeperiods.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
  162. # install start script
  163. %{l_shtool} install -c -m 755 \
  164. -e 's;@l_prefix@;%{l_prefix};g' \
  165. -e 's;@l_susr@;%{l_susr};g' \
  166. %{SOURCE rc.nagios} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  167. # install OSSP fsl configuration
  168. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  169. %{l_shtool} install -c -m 644 \
  170. -e 's;@l_prefix@;%{l_prefix};g' \
  171. %{SOURCE fsl.nagios} \
  172. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  173. # determine installation files
  174. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  175. %{l_files_std} \
  176. '%not %dir %{l_prefix}/etc/fsl' \
  177. '%config %{l_prefix}/etc/fsl/fsl.nagios'
  178. %files -f files
  179. %clean
  180. rm -rf $RPM_BUILD_ROOT