]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # TODO: | |
3 | # - move SQL module to a separate package | |
4 | # - relies on libs in /usr/ which is wrong | |
5 | # - use external libivykis.spec | |
6 | # | |
7 | # Conditional build: | |
8 | %bcond_with dynamic # link dynamically with glib, eventlog, pcre, openssl | |
9 | %if "%{pld_release}" == "ac" | |
10 | %bcond_with sql # build with support for logging to SQL DB | |
11 | %else | |
12 | %bcond_without sql # build without support for logging to SQL DB | |
13 | %endif | |
14 | %bcond_without tests | |
15 | ||
16 | %if "%{pld_release}" == "ac" | |
17 | %define glib2_ver 2.16.0 | |
18 | %else | |
19 | %define glib2_ver 2.24.0 | |
20 | %endif | |
21 | Summary: Syslog-ng - new generation of the system logger | |
22 | Summary(pl.UTF-8): Syslog-ng - zamiennik syskloga | |
23 | Summary(pt_BR.UTF-8): Daemon de log nova geração | |
24 | Name: syslog-ng | |
25 | Version: 3.3.1 | |
26 | Release: 2 | |
27 | License: GPL v2 | |
28 | Group: Daemons | |
29 | Source0: http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz | |
30 | # Source0-md5: a3dfe8a49aa8ce1aeb7e1ed5b11af378 | |
31 | Source1: %{name}.init | |
32 | Source2: %{name}.conf | |
33 | Source3: %{name}.logrotate | |
34 | Source4: http://www.balabit.com/support/documentation/syslog-ng-ose-v3.3-guide-admin-en.pdf | |
35 | # Source4-md5: bb23e36a8f44956858f2d622f9d1826d | |
36 | Source5: %{name}-simple.conf | |
37 | Source6: %{name}.upstart | |
38 | Patch0: %{name}-datadir.patch | |
39 | Patch1: cap_syslog-vserver-workaround.patch | |
40 | URL: http://www.balabit.com/products/syslog_ng/ | |
41 | BuildRequires: autoconf >= 2.53 | |
42 | BuildRequires: automake | |
43 | BuildRequires: bison | |
44 | BuildRequires: flex | |
45 | BuildRequires: pkgconfig | |
46 | BuildRequires: rpm >= 4.4.9-56 | |
47 | BuildRequires: rpmbuild(macros) >= 1.561 | |
48 | BuildRequires: which | |
49 | %if %{with tests} | |
50 | %{?with_sql:BuildRequires: libdbi-drivers-sqlite3} | |
51 | BuildRequires: python | |
52 | BuildRequires: python-modules | |
53 | BuildRequires: tzdata | |
54 | %endif | |
55 | %if %{with dynamic} | |
56 | BuildRequires: eventlog-devel >= 0.2.12 | |
57 | BuildRequires: glib2-devel >= 1:%{glib2_ver} | |
58 | BuildRequires: libcap-devel | |
59 | %{?with_sql:BuildRequires: libdbi-devel >= 0.8.3-2} | |
60 | BuildRequires: libnet-devel >= 1:1.1.2.1-3 | |
61 | BuildRequires: libwrap-devel | |
62 | BuildRequires: openssl-devel | |
63 | BuildRequires: pcre-devel | |
64 | %else | |
65 | BuildRequires: eventlog-static >= 0.2.12 | |
66 | BuildRequires: glib2-static >= 1:%{glib2_ver} | |
67 | BuildRequires: glibc-static | |
68 | BuildRequires: libcap-static | |
69 | %{?with_sql:BuildRequires: libdbi-static >= 0.8.3-2} | |
70 | BuildRequires: libnet-static >= 1:1.1.2.1-3 | |
71 | BuildRequires: libwrap-static | |
72 | BuildRequires: openssl-static | |
73 | BuildRequires: pcre-static | |
74 | BuildRequires: zlib-static | |
75 | Requires: libnet >= 1:1.1.2.1-7 | |
76 | %endif | |
77 | Requires(post): fileutils | |
78 | Requires(post,preun): /sbin/chkconfig | |
79 | Requires: glib2 >= 1:%{glib2_ver} | |
80 | Requires: psmisc >= 20.1 | |
81 | Requires: rc-scripts >= 0.4.3.0 | |
82 | Provides: syslogdaemon | |
83 | Conflicts: klogd | |
84 | Conflicts: msyslog | |
85 | Conflicts: syslog | |
86 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
87 | ||
88 | # syslog-ng has really crazy linking rules (see their bugzilla). | |
89 | # Some rules, according to syslog-ng devs, are like this: | |
90 | # - libsyslog-ng.so has undefined symbols for third party libraries | |
91 | # and these symbols should go via main syslog-ng binary | |
92 | # - same applies for modules | |
93 | %if %{without dynamic} | |
94 | %define no_install_post_check_so 1 | |
95 | # filterout_ld - see comment few lines above | |
96 | %define filterout_ld -Wl,--as-needed -Wl,--no-copy-dt-needed-entries | |
97 | %define _sbindir /sbin | |
98 | %define _libdir /%{_lib} | |
99 | %endif | |
100 | ||
101 | %description | |
102 | syslog-ng is a syslogd replacement for Unix and Unix-like systems. It | |
103 | has been tested on Solaris, BSDi and Linux, and were found to run | |
104 | reliably. syslog-ng gives you a much enhanced configuration scheme, | |
105 | which lets you filter messages based on not only priority/facility | |
106 | pairs, but also on message content. You can use regexps to direct log | |
107 | stream to different destinations. A destination can be anything from a | |
108 | simple file to a network connection. syslog-ng supports TCP | |
109 | logforwarding, together with hashing to prevent unauthorized | |
110 | modification on the line. | |
111 | ||
112 | %description -l pl.UTF-8 | |
113 | Syslog-ng jest zamiennikiem dla standardowo używanych programów typu | |
114 | syslog. Działa w systemie SunOS, BSD, Linux. Daje znacznie większe | |
115 | możliwości logowania i kontrolowania zbieranych informacji. | |
116 | ||
117 | %description -l pt_BR.UTF-8 | |
118 | Syslog-ng é um substituto para o syslog tradicional, mas com diversas | |
119 | melhorias, como, por exemplo, a habilidade de filtrar mensagens de log | |
120 | por seu conteúdo (usando expressões regulares) e não apenas pelo par | |
121 | facility/prioridade como o syslog original. | |
122 | ||
123 | %package upstart | |
124 | Summary: Upstart job description for syslog-ng | |
125 | Summary(pl.UTF-8): Opis zadania Upstart dla syslog-ng | |
126 | Group: Daemons | |
127 | Requires: %{name} = %{version}-%{release} | |
128 | Requires: upstart >= 0.6 | |
129 | Conflicts: avahi-upstart < 0.6.30-2 | |
130 | Conflicts: openssh-server-upstart < 2:5.8p2-2 | |
131 | Conflicts: postgresql-upstart < 9.0.4-2 | |
132 | ||
133 | %description upstart | |
134 | Upstart job description for syslog-ng. | |
135 | ||
136 | %description upstart -l pl.UTF-8 | |
137 | Opis zadania Upstart dla syslog-ng. | |
138 | ||
139 | %prep | |
140 | %setup -q | |
141 | %patch0 -p1 | |
142 | %patch1 -p1 | |
143 | cp -a %{SOURCE4} doc | |
144 | cp -a %{SOURCE5} contrib/syslog-ng.conf.simple | |
145 | ||
146 | %{__sed} -i -e 's|/usr/bin/awk|/bin/awk|' scl/syslogconf/convert-syslogconf.awk | |
147 | ||
148 | %build | |
149 | for i in . lib/ivykis; do | |
150 | cd $i | |
151 | %{__libtoolize} | |
152 | %{__aclocal} -I m4 | |
153 | %{__autoconf} | |
154 | %{__automake} | |
155 | cd - | |
156 | done | |
157 | %configure \ | |
158 | --sysconfdir=%{_sysconfdir}/syslog-ng \ | |
159 | --datadir=%{_datadir}/syslog-ng \ | |
160 | --with-module-dir=%{_libdir}/syslog-ng \ | |
161 | --with-timezone-dir=%{_datadir}/zoneinfo \ | |
162 | --with-pidfile-dir=/var/run \ | |
163 | --enable-ssl \ | |
164 | --enable-ipv6 \ | |
165 | --enable-tcp-wrapper \ | |
166 | --enable-spoof-source \ | |
167 | --enable-linux-caps \ | |
168 | --enable-pcre \ | |
169 | --enable-pacct \ | |
170 | %if %{with sql} | |
171 | --enable-sql \ | |
172 | %endif | |
173 | %if %{with dynamic} | |
174 | --enable-dynamic-linking | |
175 | %else | |
176 | --enable-mixed-linking | |
177 | %endif | |
178 | ||
179 | %{__make} | |
180 | ||
181 | %{?with_tests:LD_LIBRARY_PATH=$PWD/lib/.libs %{__make} check} | |
182 | ||
183 | %install | |
184 | rm -rf $RPM_BUILD_ROOT | |
185 | install -d $RPM_BUILD_ROOT/etc/{init,sysconfig,logrotate.d,rc.d/init.d} \ | |
186 | $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/patterndb.d \ | |
187 | $RPM_BUILD_ROOT/var/{log,lib/%{name}/xsd} | |
188 | ||
189 | %{__make} -j1 install \ | |
190 | DESTDIR=$RPM_BUILD_ROOT | |
191 | ||
192 | %{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/syslog-ng | |
193 | cp -a %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/syslog-ng.conf | |
194 | cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/syslog-ng | |
195 | ||
196 | for n in daemon debug iptables kernel lpr maillog messages secure spooler syslog user xferlog; do | |
197 | > $RPM_BUILD_ROOT/var/log/$n | |
198 | done | |
199 | touch $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
200 | ||
201 | %{__rm} $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}/loggen* | |
202 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la | |
203 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/syslog-ng/*.la | |
204 | ||
205 | %if "%{pld_release}" == "th" | |
206 | %{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE6} > $RPM_BUILD_ROOT/etc/init/%{name}.conf | |
207 | %endif | |
208 | ||
209 | %clean | |
210 | rm -rf $RPM_BUILD_ROOT | |
211 | ||
212 | %post | |
213 | /sbin/ldconfig | |
214 | if [ "$1" = "1" ]; then | |
215 | # disable /proc/kmsg from config on first install on vserver | |
216 | { | |
217 | while read f ctx; do | |
218 | [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break | |
219 | done </proc/self/status | |
220 | } 2>/dev/null | |
221 | if [ -z "$ctx" -o "$ctx" = "0" ]; then | |
222 | VSERVER=no | |
223 | else | |
224 | VSERVER=yes | |
225 | fi | |
226 | if [ "$VSERVER" = "yes" ]; then | |
227 | %{__sed} -i -e '/\/proc\/kmsg/ s/^[^#]/#&/' %{_sysconfdir}/%{name}/%{name}.conf | |
228 | fi | |
229 | fi | |
230 | ||
231 | /sbin/chkconfig --add syslog-ng | |
232 | %service syslog-ng restart "syslog-ng daemon" | |
233 | ||
234 | %preun | |
235 | if [ "$1" = "0" ]; then | |
236 | %service syslog-ng stop | |
237 | /sbin/chkconfig --del syslog-ng | |
238 | fi | |
239 | ||
240 | %postun -p /sbin/ldconfig | |
241 | ||
242 | %post upstart | |
243 | %upstart_post %{name} | |
244 | ||
245 | %postun upstart | |
246 | %upstart_postun %{name} | |
247 | ||
248 | %triggerun upstart -- syslog-ng-upstart < 3.2.4-3 | |
249 | # use SERVICE_syslog=y in upstart job environment instead of SERVICE=syslog | |
250 | %{__sed} -i -e 's,SERVICE=syslog,SERVICE_syslog=y,' /etc/init/*.conf || : | |
251 | ||
252 | %triggerun -- syslog-ng < 3.0 | |
253 | sed -i -e 's#sync(\(.*\))#flush_lines(\1)#g' /etc/syslog-ng/syslog-ng.conf | |
254 | sed -i -e 's#pipe ("/proc/kmsg"#file ("/proc/kmsg"#g' /etc/syslog-ng/syslog-ng.conf | |
255 | sed -i -e 's#log_prefix#program_override#g' /etc/syslog-ng/syslog-ng.conf | |
256 | sed -i -e 's#^destination #destination d_#g' /etc/syslog-ng/syslog-ng.conf | |
257 | sed -i -e 's#destination(#destination(d_#g' /etc/syslog-ng/syslog-ng.conf | |
258 | sed -i -e 's,\bstats\b,stats_freq,' /etc/syslog-ng/syslog-ng.conf | |
259 | sed -i -e 's#match("IN\=\[A-Za-z0-9\]\* OUT=\[A-Za-z0-9\]\*");#match("IN=[A-Za-z0-9]* OUT=[A-Za-z0-9]*" value("MESSAGE"));#g' /etc/syslog-ng/syslog-ng.conf | |
260 | sed -i -e "1 s#\(.*\)\$#@version: 3.0\n\1#g" /etc/syslog-ng/syslog-ng.conf | |
261 | rm -f %{_var}/lib/%{name}/syslog-ng.persist | |
262 | %service -q syslog-ng restart | |
263 | exit 0 | |
264 | ||
265 | %files | |
266 | %defattr(644,root,root,755) | |
267 | %doc AUTHORS ChangeLog NEWS debian/syslog-ng.conf* contrib/relogger.pl | |
268 | %doc contrib/syslog-ng.conf.{doc,simple,RedHat} | |
269 | %doc contrib/{apparmor,selinux,syslog2ng} doc/syslog-ng-ose-v3.3-guide-admin-en.pdf | |
270 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} | |
271 | %attr(750,root,root) %dir %{_sysconfdir}/syslog-ng | |
272 | %attr(750,root,root) %dir %{_sysconfdir}/syslog-ng/patterndb.d | |
273 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/modules.conf | |
274 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/scl.conf | |
275 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/syslog-ng.conf | |
276 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/syslog-ng | |
277 | %attr(754,root,root) /etc/rc.d/init.d/syslog-ng | |
278 | %attr(755,root,root) %{_libdir}/libsyslog-ng-%{version}.so | |
279 | %dir %{_libdir}/syslog-ng | |
280 | %attr(755,root,root) %{_libdir}/syslog-ng/lib*.so | |
281 | %attr(755,root,root) %{_sbindir}/syslog-ng | |
282 | %attr(755,root,root) %{_sbindir}/syslog-ng-ctl | |
283 | %attr(755,root,root) %{_bindir}/pdbtool | |
284 | %attr(755,root,root) %{_bindir}/update-patterndb | |
285 | ||
286 | %dir %{_datadir}/syslog-ng | |
287 | %dir %{_datadir}/syslog-ng/include | |
288 | %dir %{_datadir}/syslog-ng/include/scl | |
289 | %dir %{_datadir}/syslog-ng/include/scl/pacct | |
290 | %{_datadir}/syslog-ng/include/scl/pacct/plugin.conf | |
291 | %dir %{_datadir}/syslog-ng/include/scl/syslogconf | |
292 | %{_datadir}/syslog-ng/include/scl/syslogconf/README | |
293 | %attr(755,root,root) %{_datadir}/syslog-ng/include/scl/syslogconf/convert-syslogconf.awk | |
294 | %{_datadir}/syslog-ng/include/scl/syslogconf/plugin.conf | |
295 | %dir %{_datadir}/syslog-ng/include/scl/system | |
296 | %attr(755,root,root) %{_datadir}/syslog-ng/include/scl/system/generate-system-source.sh | |
297 | %{_datadir}/syslog-ng/include/scl/system/plugin.conf | |
298 | %dir %{_datadir}/syslog-ng/xsd | |
299 | %{_datadir}/syslog-ng/xsd/patterndb-*.xsd | |
300 | ||
301 | %dir %{_var}/lib/%{name} | |
302 | %dir %{_var}/lib/%{name}/xsd | |
303 | %{_mandir}/man1/pdbtool.1* | |
304 | %{_mandir}/man1/syslog-ng-ctl.1* | |
305 | %{_mandir}/man5/syslog-ng.conf.5* | |
306 | %{_mandir}/man8/syslog-ng.8* | |
307 | ||
308 | %attr(640,root,root) %ghost /var/log/* | |
309 | ||
310 | %if "%{pld_release}" == "th" | |
311 | %files upstart | |
312 | %defattr(644,root,root,755) | |
313 | %config(noreplace) %verify(not md5 mtime size) /etc/init/%{name}.conf | |
314 | %endif |