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