]>
Commit | Line | Data |
---|---|---|
1 | # TODO | |
2 | # - /etc/sysconfig/nginx file | |
3 | # - missing perl build/install requires | |
4 | # - nginx should have own group (and work with it) or use http group ? | |
5 | # | |
6 | # Conditional build for nginx: | |
7 | %bcond_without light # don't build light version | |
8 | %bcond_without mail # don't build imap/mail proxy | |
9 | %bcond_without perl # don't build with perl module | |
10 | %bcond_without addition # adds module | |
11 | %bcond_without dav # WebDAV | |
12 | %bcond_without flv # FLV stream | |
13 | %bcond_without ipv6 # build without ipv6 support | |
14 | %bcond_without sub # ngx_http_sub_module | |
15 | %bcond_without poll # poll | |
16 | %bcond_without realip # real ip (behind proxy) | |
17 | %bcond_without rtsig # rtsig | |
18 | %bcond_without select # select | |
19 | %bcond_without status # stats module | |
20 | %bcond_without ssl # ssl support | |
21 | %bcond_with http_browser # header "User-agent" parser | |
22 | # | |
23 | Summary: High perfomance HTTP and reverse proxy server | |
24 | Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności | |
25 | Name: nginx | |
26 | Version: 1.4.1 | |
27 | Release: 2 | |
28 | License: BSD-like | |
29 | Group: Networking/Daemons/HTTP | |
30 | Source0: http://nginx.org/download/%{name}-%{version}.tar.gz | |
31 | # Source0-md5: fea7dfab995545ce27fe4c49dc21a972 | |
32 | Source1: http://nginx.net/favicon.ico | |
33 | # Source1-md5: 2aaf2115c752cbdbfb8a2f0b3c3189ab | |
34 | Source2: proxy.conf | |
35 | Source3: %{name}.logrotate | |
36 | Source4: %{name}.mime | |
37 | Source5: %{name}-light.conf | |
38 | Source6: %{name}-light.monitrc | |
39 | Source7: %{name}-light.init | |
40 | Source8: %{name}-mail.conf | |
41 | Source9: %{name}-mail.monitrc | |
42 | Source10: %{name}-mail.init | |
43 | Source11: %{name}-perl.conf | |
44 | Source12: %{name}-perl.monitrc | |
45 | Source13: %{name}-perl.init | |
46 | Source14: %{name}-standard.conf | |
47 | Source15: %{name}-standard.monitrc | |
48 | Source16: %{name}-standard.init | |
49 | Source17: %{name}-mime.types.sh | |
50 | Patch0: nginx-no-Werror.patch | |
51 | URL: http://nginx.net/ | |
52 | BuildRequires: mailcap | |
53 | BuildRequires: openssl-devel | |
54 | BuildRequires: pcre-devel | |
55 | %{?with_perl:BuildRequires: perl-CGI} | |
56 | %{?with_perl:BuildRequires: perl-devel} | |
57 | %{?with_perl:BuildRequires: python} | |
58 | %{?with_perl:BuildRequires: rpm-perlprov} | |
59 | BuildRequires: rpmbuild(macros) >= 1.268 | |
60 | BuildRequires: zlib-devel | |
61 | Requires(post,preun): /sbin/chkconfig | |
62 | Requires(postun): /usr/sbin/groupdel | |
63 | Requires(postun): /usr/sbin/userdel | |
64 | Requires(pre): /bin/id | |
65 | Requires(pre): /usr/bin/getgid | |
66 | Requires(pre): /usr/sbin/groupadd | |
67 | Requires(pre): /usr/sbin/useradd | |
68 | #Requires: nginx-daemon | |
69 | Requires: openssl | |
70 | Requires: pcre | |
71 | Requires: rc-scripts >= 0.2.0 | |
72 | Requires: zlib | |
73 | Suggests: nginx-standard | |
74 | Provides: group(http) | |
75 | Provides: group(nginx) | |
76 | Provides: user(nginx) | |
77 | Provides: webserver | |
78 | Conflicts: logrotate < 3.8.0 | |
79 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
80 | ||
81 | %define _sysconfdir /etc/%{name} | |
82 | %define _nginxdir /home/services/%{name} | |
83 | ||
84 | %description | |
85 | nginx ("engine x") is a high-performance HTTP server and reverse | |
86 | proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor | |
87 | Sysoev for Rambler.ru, Russia's second-most visited website, where it | |
88 | has been running in production for over two and a half years. Igor has | |
89 | released the source code under a BSD-like license. Although still in | |
90 | beta, nginx is known for its stability, rich feature set, simple | |
91 | configuration, and low resource consumption. | |
92 | ||
93 | Common files for nginx daemon. | |
94 | ||
95 | %description -l pl.UTF-8 | |
96 | nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy | |
97 | a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva | |
98 | na potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości | |
99 | odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor | |
100 | opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle | |
101 | w fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków, | |
102 | prostej konfiguracji oraz małej "zasobożerności". | |
103 | ||
104 | Niezbędne pliki dla nginx. | |
105 | ||
106 | %package light | |
107 | Summary: High perfomance HTTP and reverse proxy server | |
108 | Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności | |
109 | Group: Networking/Daemons/HTTP | |
110 | Requires(post,preun): /sbin/chkconfig | |
111 | Requires(postun): /usr/sbin/groupdel | |
112 | Requires(postun): /usr/sbin/userdel | |
113 | Requires: %{name} = %{version}-%{release} | |
114 | Requires: openssl | |
115 | Requires: pcre | |
116 | Requires: zlib | |
117 | Provides: group(http) | |
118 | Provides: group(nginx) | |
119 | Provides: nginx-daemon | |
120 | Provides: user(nginx) | |
121 | Provides: webserver | |
122 | ||
123 | %description light | |
124 | The smallest, but also the fastest nginx edition. No additional | |
125 | modules, no Perl, no DAV, no FLV, no IMAP, POP3, SMTP proxy. | |
126 | ||
127 | %description light -l pl.UTF-8 | |
128 | Najmniejsza i najszybsza wersja nginx. Bez wsparcia dla Perla, DAV, | |
129 | FLV oraz IMAP, POP3, SMTP proxy. | |
130 | ||
131 | %package perl | |
132 | Summary: High perfomance HTTP and reverse proxy server | |
133 | Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności | |
134 | Group: Networking/Daemons/HTTP | |
135 | Requires(post,preun): /sbin/chkconfig | |
136 | Requires(postun): /usr/sbin/groupdel | |
137 | Requires(postun): /usr/sbin/userdel | |
138 | Requires: %{name} = %{version}-%{release} | |
139 | Requires: openssl | |
140 | Provides: group(http) | |
141 | Provides: group(nginx) | |
142 | Provides: nginx-daemon | |
143 | Provides: user(nginx) | |
144 | Provides: webserver | |
145 | ||
146 | %description perl | |
147 | nginx with Perl support. Mail modules not included. | |
148 | ||
149 | %description perl -l pl.UTF-8 | |
150 | nginx z obsługą Perla. Bez wsparcia dla modułów poczty. | |
151 | ||
152 | %package mail | |
153 | Summary: High perfomance IMAP, POP3, SMTP proxy server | |
154 | Summary(pl.UTF-8): IMAP, POP3, SMTP proxy o wysokiej wydajności | |
155 | Group: Networking/Daemons/HTTP | |
156 | Requires(post,preun): /sbin/chkconfig | |
157 | Requires(postun): /usr/sbin/groupdel | |
158 | Requires(postun): /usr/sbin/userdel | |
159 | Requires: %{name} = %{version}-%{release} | |
160 | Requires: openssl | |
161 | Requires: pcre | |
162 | Requires: zlib | |
163 | Provides: group(http) | |
164 | Provides: group(nginx) | |
165 | Provides: nginx-daemon | |
166 | Provides: user(nginx) | |
167 | Provides: webserver | |
168 | ||
169 | %description mail | |
170 | nginx with mail support. Only mail modules included. | |
171 | ||
172 | %description mail -l pl.UTF-8 | |
173 | nginx ze wsparciem tylko dla modułów poczty. | |
174 | ||
175 | %package standard | |
176 | Summary: High perfomance HTTP and reverse proxy server | |
177 | Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności | |
178 | Group: Networking/Daemons/HTTP | |
179 | Requires(post,preun): /sbin/chkconfig | |
180 | Requires(postun): /usr/sbin/groupdel | |
181 | Requires(postun): /usr/sbin/userdel | |
182 | Requires: %{name} = %{version}-%{release} | |
183 | Requires: openssl | |
184 | Provides: group(http) | |
185 | Provides: group(nginx) | |
186 | Provides: nginx-daemon | |
187 | Conflicts: logrotate < 3.7-4 | |
188 | ||
189 | %description standard | |
190 | This is standard nginx version, without Perl support and IMAP, POP3, | |
191 | SMTP proxy. | |
192 | ||
193 | %description standard -l pl.UTF-8 | |
194 | To jest standardowa wersja nginx, bez obsługi Perla oraz proxy dla | |
195 | IMAP, POP3, SMTP. | |
196 | ||
197 | %package -n monit-rc-nginx | |
198 | Summary: nginx support for monit | |
199 | Summary(pl.UTF-8): Wsparcie nginx dla monit | |
200 | Group: Applications/System | |
201 | URL: http://nginx.eu/ | |
202 | Requires: %{name} = %{version}-%{release} | |
203 | Requires: monit | |
204 | ||
205 | %description -n monit-rc-nginx | |
206 | monitrc file for monitoring nginx webserver. | |
207 | ||
208 | %description -n monit-rc-nginx -l pl.UTF-8 | |
209 | Plik monitrc do monitorowania serwera WWW nginx. | |
210 | ||
211 | %prep | |
212 | %setup -q | |
213 | %patch0 -p0 | |
214 | ||
215 | # build mime.types.conf | |
216 | #sh %{SOURCE17} /etc/mime.types | |
217 | ||
218 | %build | |
219 | # NB: not autoconf generated configure | |
220 | cp -f configure auto/ | |
221 | # | |
222 | %if %{with perl} | |
223 | ./configure \ | |
224 | --prefix=%{_prefix} \ | |
225 | --sbin-path=%{_sbindir}/%{name}-perl \ | |
226 | --conf-path=%{_sysconfdir}/%{name}-perl.conf \ | |
227 | --error-log-path=%{_localstatedir}/log/%{name}/%{name}-perl_error.log \ | |
228 | --http-log-path=%{_localstatedir}/log/%{name}/%{name}-perl_access.log \ | |
229 | --pid-path=%{_localstatedir}/run/%{name}-perl.pid \ | |
230 | --lock-path=%{_localstatedir}/lock/subsys/%{name}-perl \ | |
231 | --user=nginx \ | |
232 | --group=nginx \ | |
233 | --with-http_perl_module \ | |
234 | --without-mail_pop3_module \ | |
235 | --without-mail_imap_module \ | |
236 | --without-mail_smtp_module \ | |
237 | %{?with_addition:--with-http_addition_module} \ | |
238 | %{?with_dav:--with-http_dav_module} \ | |
239 | %{?with_flv:--with-http_flv_module} \ | |
240 | %{?with_ipv6:--with-ipv6} \ | |
241 | %{?with_sub:--with-http_sub_module} \ | |
242 | %{?with_poll:--with-poll_module} \ | |
243 | %{?with_realip:--with-http_realip_module} \ | |
244 | %{?with_rtsig:--with-rtsig_module} \ | |
245 | %{?with_select:--with-select_module} \ | |
246 | %{?with_status:--with-http_stub_status_module} \ | |
247 | %{?with_ssl:--with-http_ssl_module} \ | |
248 | %{!?with_http_browser:--without-http_browser_module} \ | |
249 | --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-perl/client_body_temp \ | |
250 | --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-perl/proxy_temp \ | |
251 | --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-perl/fastcgi_temp \ | |
252 | --with-cc="%{__cc}" \ | |
253 | --with-cc-opt="%{rpmcflags}" \ | |
254 | --with-ld-opt="%{rpmldflags}" | |
255 | %{__make} | |
256 | mv -f objs/nginx contrib/nginx-perl | |
257 | mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs contrib/nginx.bs | |
258 | mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so contrib/nginx.so | |
259 | mv -f objs/src/http/modules/perl/nginx.pm contrib/nginx.pm | |
260 | %endif | |
261 | ||
262 | %if %{with mail} | |
263 | ./configure \ | |
264 | --prefix=%{_prefix} \ | |
265 | --sbin-path=%{_sbindir}/%{name}-mail \ | |
266 | --conf-path=%{_sysconfdir}/%{name}-mail.conf \ | |
267 | --error-log-path=%{_localstatedir}/log/%{name}/%{name}-mail_error.log \ | |
268 | --http-log-path=%{_localstatedir}/log/%{name}/%{name}-mail_access.log \ | |
269 | --pid-path=%{_localstatedir}/run/%{name}-mail.pid \ | |
270 | --lock-path=%{_localstatedir}/lock/subsys/%{name}-mail \ | |
271 | --user=nginx \ | |
272 | --group=nginx \ | |
273 | --with-imap \ | |
274 | --with-mail \ | |
275 | --with-mail_ssl_module \ | |
276 | --without-http \ | |
277 | %{?with_ipv6:--with-ipv6} \ | |
278 | %{?with_poll:--with-poll_module} \ | |
279 | %{?with_rtsig:--with-rtsig_module} \ | |
280 | %{?with_select:--with-select_module} \ | |
281 | --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-mail/client_body_temp \ | |
282 | --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-mail/proxy_temp \ | |
283 | --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-mail/fastcgi_temp \ | |
284 | --with-cc="%{__cc}" \ | |
285 | --with-cc-opt="%{rpmcflags}" \ | |
286 | --with-ld-opt="%{rpmldflags}" \ | |
287 | %{?debug:--with-debug} | |
288 | %{__make} | |
289 | mv -f objs/nginx contrib/nginx-mail | |
290 | %endif | |
291 | ||
292 | %if %{with light} | |
293 | ./configure \ | |
294 | --prefix=%{_prefix} \ | |
295 | --sbin-path=%{_sbindir}/%{name}-light \ | |
296 | --conf-path=%{_sysconfdir}/%{name}-light.conf \ | |
297 | --error-log-path=%{_localstatedir}/log/%{name}/%{name}-light_error.log \ | |
298 | --http-log-path=%{_localstatedir}/log/%{name}/%{name}-light_access.log \ | |
299 | --pid-path=%{_localstatedir}/run/%{name}-light.pid \ | |
300 | --lock-path=%{_localstatedir}/lock/subsys/%{name}-light \ | |
301 | --user=nginx \ | |
302 | --group=nginx \ | |
303 | %{?with_ipv6:--with-ipv6} \ | |
304 | %{?with_poll:--with-poll_module} \ | |
305 | %{?with_realip:--with-http_realip_module} \ | |
306 | %{?with_rtsig:--with-rtsig_module} \ | |
307 | %{?with_select:--with-select_module} \ | |
308 | %{?with_status:--with-http_stub_status_module} \ | |
309 | %{?with_ssl:--with-http_ssl_module} \ | |
310 | --without-http_browser_module \ | |
311 | --without-mail_pop3_module \ | |
312 | --without-mail_imap_module \ | |
313 | --without-mail_smtp_module \ | |
314 | --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-light/client_body_temp \ | |
315 | --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-light/proxy_temp \ | |
316 | --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-light/fastcgi_temp \ | |
317 | --with-cc="%{__cc}" \ | |
318 | --with-cc-opt="%{rpmcflags}" \ | |
319 | --with-ld-opt="%{rpmldflags}" \ | |
320 | %{?debug:--with-debug} | |
321 | %{__make} | |
322 | mv -f objs/nginx contrib/nginx-light | |
323 | %endif | |
324 | ||
325 | ./configure \ | |
326 | --prefix=%{_prefix} \ | |
327 | --sbin-path=%{_sbindir}/%{name}-standard \ | |
328 | --conf-path=%{_sysconfdir}/%{name}-standard.conf \ | |
329 | --error-log-path=%{_localstatedir}/log/%{name}/%{name}-standard_error.log \ | |
330 | --http-log-path=%{_localstatedir}/log/%{name}/%{name}-standard_access.log \ | |
331 | --pid-path=%{_localstatedir}/run/%{name}-standard.pid \ | |
332 | --lock-path=%{_localstatedir}/lock/subsys/%{name}-standard \ | |
333 | --user=nginx \ | |
334 | --group=nginx \ | |
335 | %{?with_addition:--with-http_addition_module} \ | |
336 | %{?with_dav:--with-http_dav_module} \ | |
337 | %{?with_flv:--with-http_flv_module} \ | |
338 | %{?with_ipv6:--with-ipv6} \ | |
339 | %{?with_sub:--with-http_sub_module} \ | |
340 | %{?with_poll:--with-poll_module} \ | |
341 | %{?with_realip:--with-http_realip_module} \ | |
342 | %{?with_rtsig:--with-rtsig_module} \ | |
343 | %{?with_select:--with-select_module} \ | |
344 | %{?with_status:--with-http_stub_status_module} \ | |
345 | %{?with_ssl:--with-http_ssl_module} \ | |
346 | %{!?with_http_browser:--without-http_browser_module} \ | |
347 | --http-client-body-temp-path=%{_localstatedir}/cache/%{name}-standard/client_body_temp \ | |
348 | --http-proxy-temp-path=%{_localstatedir}/cache/%{name}-standard/proxy_temp \ | |
349 | --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}-standard/fastcgi_temp \ | |
350 | --with-cc="%{__cc}" \ | |
351 | --with-cc-opt="%{rpmcflags}" \ | |
352 | --with-ld-opt="%{rpmldflags}" \ | |
353 | %{?debug:--with-debug} | |
354 | %{__make} | |
355 | ||
356 | ||
357 | %install | |
358 | rm -rf $RPM_BUILD_ROOT | |
359 | install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \ | |
360 | $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \ | |
361 | $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \ | |
362 | $RPM_BUILD_ROOT%{_localstatedir}/cache/{%{name}-standard,%{name}-perl,%{name}-mail,%{name}-light} \ | |
363 | $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/{%{name}-standard,%{name}-perl,%{name}-mail,%{name}-light} \ | |
364 | $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \ | |
365 | $RPM_BUILD_ROOT/etc/{logrotate.d,monit} | |
366 | ||
367 | install conf/fastcgi_params $RPM_BUILD_ROOT%{_sysconfdir}/fastcgi.params | |
368 | install conf/koi-utf $RPM_BUILD_ROOT%{_sysconfdir}/koi-utf | |
369 | install conf/koi-win $RPM_BUILD_ROOT%{_sysconfdir}/koi-win | |
370 | install conf/win-utf $RPM_BUILD_ROOT%{_sysconfdir}/win-utf | |
371 | install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html | |
372 | install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors | |
373 | install %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico | |
374 | install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf | |
375 | install %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} | |
376 | install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types | |
377 | install %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-standard.conf | |
378 | install %{SOURCE15} $RPM_BUILD_ROOT/etc/monit/%{name}-standard.monitrc | |
379 | install %{SOURCE16} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-standard | |
380 | install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}-standard | |
381 | ||
382 | %if %{with light} | |
383 | install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-light.conf | |
384 | install %{SOURCE6} $RPM_BUILD_ROOT/etc/monit/%{name}-light.monitrc | |
385 | install %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-light | |
386 | install contrib/nginx-light $RPM_BUILD_ROOT%{_sbindir}/%{name}-light | |
387 | %endif | |
388 | ||
389 | %if %{with mail} | |
390 | install %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-mail.conf | |
391 | install %{SOURCE9} $RPM_BUILD_ROOT/etc/monit/%{name}-mail.monitrc | |
392 | install %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-mail | |
393 | install contrib/nginx-mail $RPM_BUILD_ROOT%{_sbindir}/%{name}-mail | |
394 | %endif | |
395 | ||
396 | %if %{with perl} | |
397 | install -d $RPM_BUILD_ROOT{%{perl_vendorarch},%{perl_vendorarch}/auto/%{name}} | |
398 | install %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-perl.conf | |
399 | install %{SOURCE12} $RPM_BUILD_ROOT/etc/monit/%{name}-perl.monitrc | |
400 | install %{SOURCE13} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-perl | |
401 | install contrib/nginx.pm $RPM_BUILD_ROOT%{perl_vendorarch}/%{name}.pm | |
402 | install contrib/nginx.so $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.so | |
403 | install contrib/nginx.bs $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.bs | |
404 | install contrib/nginx-perl $RPM_BUILD_ROOT%{_sbindir}/%{name}-perl | |
405 | %endif | |
406 | ||
407 | rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default | |
408 | rm -rf $RPM_BUILD_ROOT%{_prefix}/html | |
409 | ||
410 | %clean | |
411 | rm -rf $RPM_BUILD_ROOT | |
412 | ||
413 | %pre | |
414 | %groupadd -r -g 213 %{name} | |
415 | %groupadd -g 51 http | |
416 | %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name} | |
417 | %addusertogroup %{name} http | |
418 | ||
419 | %post standard | |
420 | for a in access.log error.log; do | |
421 | if [ ! -f /var/log/%{name}/nginx-standard_$a ]; then | |
422 | umask 022 | |
423 | touch /var/log/%{name}/nginx-standard_$a | |
424 | chown nginx:nginx /var/log/%{name}/nginx-standard_$a | |
425 | chmod 644 /var/log/%{name}/nginx-standard_$a | |
426 | fi | |
427 | done | |
428 | /sbin/chkconfig --add %{name}-standard | |
429 | %service %{name}-standard restart | |
430 | echo 'NOTE: daemon is now using "/etc/nginx/nginx-standard.conf" as config.' | |
431 | ||
432 | %post light | |
433 | for a in access.log error.log; do | |
434 | if [ ! -f /var/log/%{name}/nginx-light_$a ]; then | |
435 | umask 022 | |
436 | touch /var/log/%{name}/nginx-light_$a | |
437 | chown nginx:nginx /var/log/%{name}/nginx-light_$a | |
438 | chmod 644 /var/log/%{name}/nginx-light_$a | |
439 | fi | |
440 | done | |
441 | /sbin/chkconfig --add %{name}-light | |
442 | %service %{name}-light restart | |
443 | echo 'NOTE: daemon is now using "/etc/nginx/nginx-light.conf" as config' | |
444 | ||
445 | %post perl | |
446 | for a in access.log error.log; do | |
447 | if [ ! -f /var/log/%{name}/nginx-perl_$a ]; then | |
448 | umask 022 | |
449 | touch /var/log/%{name}/nginx-perl_$a | |
450 | chown nginx:nginx /var/log/%{name}/nginx-perl_$a | |
451 | chmod 644 /var/log/%{name}/nginx-perl_$a | |
452 | fi | |
453 | done | |
454 | /sbin/chkconfig --add %{name}-perl | |
455 | %service %{name}-perl restart | |
456 | echo 'NOTE: daemon is now using "/etc/nginx/nginx-perl.conf" as config' | |
457 | ||
458 | %post mail | |
459 | for a in access.log error.log; do | |
460 | if [ ! -f /var/log/%{name}/nginx-mail_$a ]; then | |
461 | umask 022 | |
462 | touch /var/log/%{name}/nginx-mail_$a | |
463 | chown nginx:nginx /var/log/%{name}/nginx-mail_$a | |
464 | chmod 644 /var/log/%{name}/nginx-mail_$a | |
465 | fi | |
466 | done | |
467 | /sbin/chkconfig --add %{name}-mail | |
468 | %service %{name}-mail restart | |
469 | echo 'NOTE: daemon is now using "/etc/nginx/nginx-mail.conf" as config' | |
470 | ||
471 | %preun standard | |
472 | if [ "$1" = "0" ];then | |
473 | %service %{name}-standard stop | |
474 | /sbin/chkconfig --del %{name}-standard | |
475 | fi | |
476 | ||
477 | %preun light | |
478 | if [ "$1" = "0" ]; then | |
479 | %service %{name}-light stop | |
480 | /sbin/chkconfig --del %{name}-light | |
481 | fi | |
482 | ||
483 | %preun perl | |
484 | if [ "$1" = "0" ]; then | |
485 | %service %{name}-perl stop | |
486 | /sbin/chkconfig --del %{name}-perl | |
487 | fi | |
488 | ||
489 | %preun mail | |
490 | if [ "$1" = "0" ]; then | |
491 | %service %{name}-mail stop | |
492 | /sbin/chkconfig --del %{name}-mail | |
493 | fi | |
494 | ||
495 | %postun | |
496 | if [ "$1" = "0" ]; then | |
497 | %userremove %{name} | |
498 | %groupremove %{name} | |
499 | fi | |
500 | ||
501 | %files | |
502 | %defattr(644,root,root,755) | |
503 | %doc CHANGES LICENSE README html/index.html conf/nginx.conf | |
504 | %doc %lang(ru) CHANGES.ru | |
505 | %dir %attr(754,root,root) %{_sysconfdir} | |
506 | %dir %{_nginxdir} | |
507 | %dir %{_nginxdir}/cgi-bin | |
508 | %dir %{_nginxdir}/html | |
509 | %dir %{_nginxdir}/errors | |
510 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} | |
511 | # XXX: duplicates, don't use such glob here | |
512 | #%attr(640,root,root) %{_sysconfdir}/*[_-]* | |
513 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf | |
514 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi.params | |
515 | %attr(640,root,root) %{_sysconfdir}/mime.types | |
516 | %attr(640,root,root) %{_sysconfdir}/koi-utf | |
517 | %attr(640,root,root) %{_sysconfdir}/koi-win | |
518 | %attr(640,root,root) %{_sysconfdir}/win-utf | |
519 | %attr(750,nginx,logs) %dir /var/log/archive/%{name} | |
520 | %attr(750,nginx,logs) /var/log/%{name} | |
521 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/* | |
522 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/* | |
523 | ||
524 | %files standard | |
525 | %defattr(644,root,root,755) | |
526 | %attr(755,root,root) %{_sbindir}/%{name}-standard | |
527 | %attr(770,root,%{name}) /var/cache/%{name}-standard | |
528 | %attr(754,root,root) /etc/rc.d/init.d/%{name}-standard | |
529 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-standard.conf | |
530 | ||
531 | %if %{with mail} | |
532 | %files mail | |
533 | %defattr(644,root,root,755) | |
534 | %attr(755,root,root) %{_sbindir}/%{name}-mail | |
535 | %attr(770,root,%{name}) /var/cache/%{name}-mail | |
536 | %attr(754,root,root) /etc/rc.d/init.d/%{name}-mail | |
537 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-mail.conf | |
538 | %endif | |
539 | ||
540 | %if %{with light} | |
541 | %files light | |
542 | %defattr(644,root,root,755) | |
543 | %attr(755,root,root) %{_sbindir}/%{name}-light | |
544 | %attr(770,root,%{name}) /var/cache/%{name}-light | |
545 | %attr(754,root,root) /etc/rc.d/init.d/%{name}-light | |
546 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-light.conf | |
547 | %endif | |
548 | ||
549 | %if %{with perl} | |
550 | %files perl | |
551 | %defattr(644,root,root,755) | |
552 | %attr(755,root,root) %{_sbindir}/%{name}-perl | |
553 | %attr(754,root,root) /etc/rc.d/init.d/%{name}-perl | |
554 | %attr(770,root,%{name}) /var/cache/%{name}-perl | |
555 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}-perl.conf | |
556 | %dir %{perl_vendorarch}/auto/%{name} | |
557 | %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so | |
558 | %{perl_vendorarch}/auto/%{name}/%{name}.bs | |
559 | %{perl_vendorarch}/%{name}.pm | |
560 | %endif | |
561 | ||
562 | %files -n monit-rc-nginx | |
563 | %defattr(644,root,root,755) | |
564 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-standard.monitrc | |
565 | %if %{with perl} | |
566 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-perl.monitrc | |
567 | %endif | |
568 | %if %{with light} | |
569 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-light.monitrc | |
570 | %endif | |
571 | %if %{with mail} | |
572 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}-mail.monitrc | |
573 | %endif |