]> git.pld-linux.org Git - packages/nagios.git/blob - nagios.spec
- use user/group macros
[packages/nagios.git] / nagios.spec
1 #
2 # Conditional build:
3 %bcond_with     pgsql   # enable pgsql support
4 %bcond_with     mysql   # enable mysql support
5 %bcond_without  gd      # without statusmap and trends, which require gd library
6 #
7 # TODO:
8 # - remove *-sample from /etc - move it to %doc or place without "-sample" suffix
9 Summary:        Host/service/network monitoring program
10 Summary(pl):    Program do monitorowania serwerów/us³ug/sieci
11 Summary(pt_BR): Programa para monitoração de máquinas e serviços
12 Name:           nagios
13 Version:        1.2
14 Release:        3
15 License:        GPL v2
16 Group:          Networking
17 Source0:        http://dl.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
18 # Source0-md5:  414d70e5269d5b8d7c21bf3ee129309f
19 Source1:        %{name}-apache.conf
20 Source2:        %{name}.init
21 Patch0:         %{name}-pgsql.patch
22 Patch1:         %{name}-resources.patch
23 Patch2:         %{name}-iconv-in-libc.patch
24 URL:            http://www.nagios.org/
25 BuildRequires:  autoconf
26 BuildRequires:  automake
27 %{?with_gd:BuildRequires:       gd-devel}
28 %{?with_mysql:BuildRequires:    mysql-devel}
29 %{?with_pgsql:BuildRequires:    postgresql-devel}
30 PreReq:         rc-scripts
31 PreReq:         sh-utils
32 Requires(pre):  /usr/bin/getgid
33 Requires(pre):  /bin/id
34 Requires(pre):  /usr/sbin/groupadd
35 Requires(pre):  /usr/sbin/useradd
36 Requires(post,postun):  /sbin/chkconfig
37 Provides:       user(%{name})
38 Provides:       group(%{name})
39 Conflicts:      iputils-ping < 1:ss020124
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 Obsoletes:      netsaint
42
43 %define         _sysconfdir     /etc/%{name}
44 %define         _bindir         %{_prefix}/sbin
45 %define         _sbindir        %{_libdir}/%{name}/cgi
46 %define         _datadir        %{_prefix}/share/%{name}
47 %define         _localstatedir  /var/lib/%{name}
48
49 %description
50 Nagios is a program that will monitor hosts and services on your
51 network. It has the ability to email or page you when a problem arises
52 and when a problem is resolved. Nagios is written in C and is designed
53 to run under Linux (and some other *NIX variants) as a background
54 process, intermittently running checks on various services that you
55 specify.
56
57 The actual service checks are performed by separate "plugin" programs
58 which return the status of the checks to Nagios. The plugins are
59 available in nagios-plugins packages.
60
61 Nagios is successor to NetSaint.
62
63 %description -l pl
64 Nagios to program, który monitoruje serwery oraz us³ugi w naszej
65 sieci. Posiada on mo¿liwo¶æ wysy³ania informacji o wyst±pieniu oraz
66 rozwi±zaniu problemu. Nagios zosta³ napisany w C oraz jest
67 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
68 jako proces pracuj±cy w tle i bezustannie wykonuj±cy pewne operacje
69 sprawdzaj±ce.
70
71 W³a¶ciwe sprawdzanie jest wykonywane przez osobne programy
72 ("wtyczki"), które zwracaj± informacje o statusie do Nagiosa. Wtyczki
73 s± dostêpne na stronie w pakietach nagios-plugins.
74
75 Nagios jest nastêpc± NetSainta.
76
77 %description -l pt_BR
78 O Nagios é um programa que monitora máquinas e serviços na sua rede.
79 Ele pode enviar um email ou um aviso de pager para o administrador
80 quando surgir um problema e quando ele for resolvido. Nagios é escrito
81 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
82 variações de *NIX) como um processo em segundo plano, periodicamente
83 executando checagens nos diversos serviços que forem especificados.
84
85 %package cgi
86 Summary:        CGI webinterface for Nagios
87 Summary(pl):    Interfejs WWW/CGI dla Nagiosa
88 Group:          Networking
89 # for dirs... and accessing local logs(?)
90 Requires:       %{name} = %{version}-%{release}
91 Requires:       apache
92
93 %description cgi
94 CGI webinterface for Nagios.
95
96 %description cgi -l pl
97 Interfejs CGI dla Nagiosa.
98
99 %package devel
100 Summary:        Include files that Netsaint-related applications may compile against
101 Summary(pl):    Pliki nag³ówkowe, wykorzystywane przez aplikacje nagiosa
102 Summary(pt_BR): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
103 Group:          Development/Libraries
104 # doesn't require base
105
106 %description devel
107 This package provides include files that Netsaint-related applications
108 may compile against.
109
110 %description devel -l pl
111 Ten pakiet dostarcza pliki nag³ówkowe, które mog± byæ wykorzystywane
112 przez aplikacje zwi±zane z nagiosem podczas kompilacji.
113
114 %description devel -l pt_BR
115 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
116 aplicativos para o Nagios.
117
118 %prep
119 %setup -q
120 %{?with_pgsql:%patch0 -p1}
121 %patch1 -p0
122 %patch2 -p1
123
124 %build
125 %{__aclocal}
126 %{__autoconf}
127 %configure \
128         --with-nagios-user=%{name} \
129         --with-nagios-grp=%{name} \
130         --with-command-user=nobody \
131         --with-command-grp=nobody \
132         --with-lockfile=/var/run/%{name}.pid \
133         --with-ping_command='/bin/ping -n %%s -c %%d' \
134         %{?with_mysql:--with-mysql-xdata --with-mysql-status --with-mysql-comments --with-mysql-extinfo --with-mysql-retention --with-mysql-downtime --with-mysql-lib=%{_libdir} --with-mysql-inc=%{_includedir}/mysql} \
135         %{?with_pgsql:--with-pgsql-xdata --with-pgsql-status --with-pgsql-comments --with-pgsql-extinfo --with-pgsql-retention --with-pgsql-downtime--with-pgsql-lib=%{_libdir} --with-pgsql-inc=%{_includedir}/postgresql} \
136         %{!?with_gd:--disable-statusmap --disable-trends}
137
138 %{__make} all
139
140 %install
141 rm -rf $RPM_BUILD_ROOT
142 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,httpd},%{_includedir}/%{name},%{_libdir}/%{name}/plugins} \
143         $RPM_BUILD_ROOT{%{_var}/log/%{name},%{_localstatedir}}
144
145 install common/locations.h      $RPM_BUILD_ROOT%{_includedir}/%{name}
146
147 %{__make} install install-html install-config install-init install-commandmode fullinstall \
148         DESTDIR=$RPM_BUILD_ROOT \
149         INSTALL_OPTS="" \
150         INIT_OPTS="" \
151         COMMAND_OPTS=""
152
153 install %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
154 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
155
156 %clean
157 rm -rf $RPM_BUILD_ROOT
158
159 %pre
160 if [ -n "`getgid %{name}`" ]; then
161         if [ "`getgid %{name}`" != "72" ]; then
162                 echo "Error: group %{name} doesn't have gid=72. Correct this before installing %{name}." 1>&2
163                 exit 1
164         fi
165 else
166         /usr/sbin/groupadd -g 72 -f %{name}
167 fi
168 if [ -n "`id -u %{name} 2>/dev/null`" ]; then
169         if [ "`id -u %{name}`" != "72" ]; then
170                 echo "Error: user %{name} doesn't have uid=72. Correct this before installing %{name}." 1>&2
171                 exit 1
172         fi
173 else
174         /usr/sbin/useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "%{name} User" -g %{name} %{name} 1>&2
175 fi
176
177 %post
178 /sbin/chkconfig --add %{name}
179 if [ -f /var/lock/subsys/%{name} ]; then
180         /etc/rc.d/init.d/%{name} restart 1>&2
181 fi
182
183 %preun
184 if [ "$1" = "0" ] ; then
185         if [ -f /var/lock/subsys/%{name} ]; then
186                 /etc/rc.d/init.d/%{name} stop 1>&2
187         fi
188         /sbin/chkconfig --del %{name}
189 fi
190
191 %postun
192 if [ "$1" = "0" ]; then
193         %userremove %{name}
194         %groupremove %{name}
195 fi
196
197 %files
198 %defattr(644,root,root,755)
199 %doc Changelog README* UPGRADING contrib/database
200 %attr(754,root,root) /etc/rc.d/init.d/%{name}
201 %attr(751,root,nagios) %dir %{_sysconfdir}
202 %attr(644,root,nagios) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/[!c]*
203 %attr(644,root,nagios) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/c[!g]*
204 %dir %{_libdir}/%{name}
205 %dir %{_libdir}/%{name}/plugins
206 %attr(755,root,root) %{_bindir}/%{name}
207 %attr(771,nagios,http) %{_var}/log/%{name}
208 %attr(775,nagios,nagios) %dir %{_localstatedir}
209 %attr(775,nagios,nagios) %dir %{_localstatedir}/archives
210 %attr(2775,nagios,http) %dir %{_localstatedir}/rw
211
212 %files cgi
213 %defattr(644,root,root,755)
214 %attr(640,root,http) %config(noreplace) %verify(not size mtime md5) /etc/httpd/%{name}.conf
215 %attr(644,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cgi.cfg-sample
216 %dir %{_libdir}/%{name}/cgi
217 %attr(755,root,root) %{_libdir}/%{name}/cgi/*.cgi
218 %{_datadir}
219
220 %files devel
221 %defattr(644,root,root,755)
222 %dir %{_includedir}/%{name}
223 %{_includedir}/%{name}/*.h
This page took 0.074864 seconds and 4 git commands to generate.