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