]>
Commit | Line | Data |
---|---|---|
e2bda3a7 | 1 | |
e9f604ed | 2 | # Conditional build: |
3 | %bcond_with pam # PAM authentication support | |
e2bda3a7 | 4 | %bcond_with logdb # enable mod_logdb (server-side message logging) |
c4f8aa56 | 5 | %bcond_with weaker_crypto # enable SSLv3 |
eddf5b64 | 6 | |
fb70a56e | 7 | Summary: Fault-tolerant distributed Jabber/XMPP server |
7abad569 | 8 | Summary(pl.UTF-8): Odporny na awarie rozproszony serwer Jabbera/XMPP |
d798517a | 9 | Name: ejabberd |
e2bda3a7 | 10 | Version: 13.10 |
ad069f72 | 11 | Release: 1 |
fb70a56e JK |
12 | License: GPL |
13 | Group: Applications/Communications | |
d798517a | 14 | Source0: http://www.process-one.net/downloads/ejabberd/%{version}/%{name}-%{version}.tgz |
e2bda3a7 | 15 | # Source0-md5: 94ce4fe244ee72771eeafe27209d6d3c |
d798517a JK |
16 | Source1: %{name}.init |
17 | Source2: %{name}.sysconfig | |
18 | Source3: %{name}.service | |
e2bda3a7 JK |
19 | # |
20 | # Archives created with the ejabberd-pack_deps.sh script (in this repo) | |
21 | Source10: ejabberd-goldrush-20131108.tar.gz | |
22 | # Source10-md5: 3f61708d20fcee2e7d47036cc470f4e9 | |
23 | Source11: ejabberd-lager-20131111.tar.gz | |
24 | # Source11-md5: e0933da9d0462b045f6b9c4bbd320d3e | |
25 | Source12: ejabberd-p1_cache_tab-20130515.tar.gz | |
26 | # Source12-md5: f2500cffdaff434b354d01eeb24d136d | |
27 | Source13: ejabberd-p1_iconv-20130602.tar.gz | |
28 | # Source13-md5: ab0118d4097ee756f65fd087265c88ae | |
29 | Source14: ejabberd-p1_stringprep-20131113.tar.gz | |
30 | # Source14-md5: 282d70c792a78ea9a7415b0b4e65e157 | |
31 | Source15: ejabberd-p1_tls-20130717.tar.gz | |
32 | # Source15-md5: 1211c5d8f0a95b58dfc5fb5bf4e13ded | |
33 | Source16: ejabberd-p1_xml-20131017.tar.gz | |
34 | # Source16-md5: dc7ebd7ed1ed6340ff0e7739173d4438 | |
35 | Source17: ejabberd-p1_yaml-20131031.tar.gz | |
36 | # Source17-md5: 82d4bb5c5d56ab93a60f5d1c6e583dc1 | |
37 | Source18: ejabberd-p1_zlib-20130515.tar.gz | |
38 | # Source18-md5: a203d9359122ead64966eeb0bd1c8cf7 | |
39 | Source19: ejabberd-xmlrpc-20130116.tar.gz | |
40 | # Source19-md5: 22e02ff7ca174b4ac225005f63da10ad | |
41 | Source20: ejabberd-jiffy-20130702.tar.gz | |
42 | # Source20-md5: 01b156e97005f07ce8bb46ecf27471ff | |
43 | Source21: ejabberd-p1_mysql-20131024.tar.gz | |
44 | # Source21-md5: c02921f21ba030357d2cbbbf182af54a | |
45 | Source22: ejabberd-p1_pam-20130515.tar.gz | |
46 | # Source22-md5: 0ca31094d93dfb047f05c7539136433a | |
47 | Source23: ejabberd-p1_pgsql-20130515.tar.gz | |
48 | # Source23-md5: 1958be8e59d1b472499ef1bdf8edc1db | |
49 | Source24: ejabberd-p1_stun-20130624.tar.gz | |
50 | # Source24-md5: 9a1c5ad9b3b95364d3f76446fcf58dc3 | |
51 | # | |
d798517a JK |
52 | Patch0: %{name}-paths.patch |
53 | Patch1: %{name}-config.patch | |
e2bda3a7 | 54 | # not available for 13.10 |
d798517a | 55 | #Patch2: %{name}-vcard-access-get.patch |
0d78319d | 56 | # http://www.dp.uz.gov.ua/o.palij/mod_logdb/patch-mod_logdb-2.1.12.diff |
d798517a | 57 | Patch3: %{name}-mod_logdb.patch |
c4f8aa56 | 58 | Patch4: %{name}-no_sslv3_or_3des.patch |
3f2196e7 | 59 | URL: http://www.ejabberd.im/ |
fb70a56e | 60 | BuildRequires: autoconf |
1a2644b6 | 61 | BuildRequires: automake |
60c3a68c | 62 | BuildRequires: erlang >= 1:R15B01 |
6f0d08c1 | 63 | BuildRequires: expat-devel >= 1.95 |
64 | BuildRequires: openssl-devel | |
e9f604ed | 65 | %if %{with pam} |
66 | BuildRequires: pam-devel | |
67 | %endif | |
67271627 | 68 | BuildRequires: rpmbuild(macros) >= 1.671 |
60c3a68c | 69 | BuildRequires: yaml-devel |
01f61704 | 70 | BuildRequires: zlib-devel |
8e141538 | 71 | BuildRequires: git-core |
27b10c8b | 72 | Requires(post): /usr/bin/perl |
b15a901d | 73 | Requires(post): jabber-common |
0d54398f | 74 | Requires(post): sed >= 4.0 |
fb70a56e | 75 | Requires(post): textutils |
fb70a56e | 76 | Requires(post,preun): /sbin/chkconfig |
67271627 | 77 | Requires(post,preun,postun): systemd-units >= 38 |
9a105ba4 | 78 | Requires: erlang >= 1:R15B01 |
bb159536 | 79 | Requires: expat >= 1.95 |
27b10c8b | 80 | Requires: rc-scripts |
67271627 | 81 | Requires: systemd-units >= 38 |
fb70a56e JK |
82 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
83 | ||
fcf4c7a2 JK |
84 | %define _noautoprovfiles %{_libdir}/%{name}/priv/lib/ |
85 | ||
fb70a56e | 86 | %description |
472227c5 | 87 | ejabberd is a Free and Open Source fault-tolerant distributed Jabber |
88 | server. It is written mostly in Erlang. | |
fb70a56e | 89 | |
e0166ea5 JR |
90 | %description -l pl.UTF-8 |
91 | ejabberd to darmowy, z otwartymi źródłami, odporny na awarie | |
92 | rozproszony serwer Jabbera. Jest napisany w większości w Erlangu. | |
378431cb | 93 | |
cba58599 | 94 | %package logdb |
1a2644b6 | 95 | Summary: Server-side logging module |
cba58599 | 96 | Group: Applications/Communications |
97 | Requires: %{name} = %{version}-%{release} | |
98 | ||
99 | %description logdb | |
100 | Server-side logging module. | |
101 | ||
fb70a56e | 102 | %prep |
e2bda3a7 | 103 | %setup -q -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20 -a 21 -a 22 -a 23 -a 24 |
fb70a56e | 104 | %patch0 -p1 |
7f71a53c JK |
105 | %patch1 -p1 |
106 | #%%patch2 -p1 | |
9953f9cb | 107 | %if %{with logdb} |
7f71a53c | 108 | %patch3 -p0 |
9953f9cb | 109 | %endif |
c4f8aa56 JK |
110 | %if %{without weaker_crypto} |
111 | %patch4 -p1 | |
112 | %endif | |
fb70a56e | 113 | |
8e141538 JK |
114 | # Various parts of the build system use 'git describe' |
115 | # which returns nonsense on manual builds using the builder script | |
116 | # and which fails on the PLD builders | |
117 | # I was not able to locate all 'git describe' invocation, sot let's | |
118 | # fool them with this dummy repository | |
119 | unset GIT_DIR GIT_WORK_TREE | |
120 | git init | |
d798661f JK |
121 | git config user.email "dummy@example.com" |
122 | git config user.name "Dummy" | |
8e141538 JK |
123 | git add configure.ac |
124 | git commit -a -m "dummy commit" | |
125 | git tag "%{version}" | |
fb8f9840 | 126 | |
fb70a56e | 127 | %build |
8e141538 | 128 | unset GIT_DIR GIT_WORK_TREE |
e2bda3a7 | 129 | %{__aclocal} -I m4 |
fb70a56e | 130 | %{__autoconf} |
6b419144 | 131 | %configure \ |
5613d9b6 AM |
132 | %{?with_pam --enable-pam} \ |
133 | --with-openssl=%{_prefix} \ | |
e4f8c955 | 134 | --enable-user=jabber \ |
e2bda3a7 JK |
135 | --enable-full-xml \ |
136 | --enable-nif \ | |
137 | --enable-odbc \ | |
138 | --enable-mysql \ | |
139 | --enable-pgsql \ | |
140 | %{?with_pam:--enable-pam} \ | |
141 | --enable-zlib \ | |
142 | --enable-stun \ | |
143 | --enable-json \ | |
144 | --enable-iconv \ | |
145 | --enable-lager | |
146 | touch deps/.got | |
147 | ||
148 | cd deps/p1_iconv | |
149 | %configure | |
150 | cd ../.. | |
151 | cd deps/p1_stringprep | |
152 | %configure | |
153 | cd ../.. | |
154 | cd deps/p1_tls | |
155 | %configure | |
156 | cd ../.. | |
157 | cd deps/p1_xml | |
158 | %configure \ | |
159 | --enable-nif \ | |
160 | --enable-full-xml | |
161 | cd ../.. | |
162 | cd deps/p1_yaml | |
163 | %configure | |
164 | cd ../.. | |
165 | cd deps/p1_zlib | |
166 | %configure | |
167 | cd ../.. | |
168 | ||
92a38251 | 169 | %{__make} -j1 |
fb70a56e JK |
170 | |
171 | %install | |
172 | rm -rf $RPM_BUILD_ROOT | |
d798517a | 173 | install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \ |
67271627 | 174 | $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}} |
fb70a56e | 175 | |
8e141538 JK |
176 | unset GIT_DIR GIT_WORK_TREE |
177 | ||
e2bda3a7 | 178 | %{__make} install -j1 \ |
e4f8c955 JK |
179 | CHOWN_COMMAND=true \ |
180 | O_USER="" \ | |
181 | G_USER="" \ | |
27b10c8b | 182 | DESTDIR=$RPM_BUILD_ROOT |
fb70a56e | 183 | |
d798517a JK |
184 | sed -e's,@libdir@,%{_libdir},g' -e 's,@EJABBERD_DOC_PATH@,%{_docdir}/%{name}-%{version}/doc,g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
185 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
67271627 | 186 | install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service |
fb70a56e | 187 | |
d798517a | 188 | chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}* |
fb70a56e | 189 | |
5613d9b6 AM |
190 | chmod 755 $RPM_BUILD_ROOT%{_libdir}/ejabberd/priv/lib/*.so |
191 | ||
e2bda3a7 JK |
192 | rm -rf _doc 2>/dev/null || : |
193 | mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc | |
059c0bab | 194 | |
fcf4c7a2 JK |
195 | touch $RPM_BUILD_ROOT%{_sysconfdir}/jabber/ejabberd.cfg |
196 | touch $RPM_BUILD_ROOT/var/lib/ejabberd/.erlang.cookie | |
197 | ||
fb70a56e JK |
198 | %clean |
199 | rm -rf $RPM_BUILD_ROOT | |
200 | ||
e2bda3a7 JK |
201 | %pre |
202 | if [ -e /etc/jabber/ejabberd.cfg ] ; then | |
fcf4c7a2 JK |
203 | %banner -e %{name} <<'EOF' |
204 | Old-style /etc/jabber/ejabberd.cfg configuration file exists. You should | |
205 | consider converting it to the new YAML format. You can do this with the | |
7102eb90 | 206 | 'ejabberctl convert_to_yaml' command. |
fcf4c7a2 | 207 | EOF |
e2bda3a7 JK |
208 | fi |
209 | ||
fb70a56e | 210 | %post |
0d54398f | 211 | if [ -f %{_sysconfdir}/jabber/secret ] ; then |
7f71a53c | 212 | SECRET="$(cat %{_sysconfdir}/jabber/secret)" |
fb70a56e | 213 | if [ -n "$SECRET" ] ; then |
7f71a53c JK |
214 | echo -n "Updating component authentication secret in ejabberd config file..." >&2 |
215 | %{__sed} -i -e "s/@service_secret@/$SECRET/" /etc/jabber/ejabberd.yml | |
216 | echo "done" >&2 | |
fb70a56e JK |
217 | fi |
218 | fi | |
fb70a56e | 219 | /sbin/chkconfig --add ejabberd |
7102eb90 JK |
220 | if [ -e /var/run/%{name}-upgrade-trigger ] ; then |
221 | # service will be restarted in the postun trigger | |
222 | rm -f /var/run/%{name}-upgrade-trigger || : | |
223 | else | |
224 | %service ejabberd restart "ejabberd server" | |
225 | %systemd_post %{name}.service | |
226 | fi | |
67271627 | 227 | |
fb70a56e JK |
228 | %preun |
229 | if [ "$1" = "0" ]; then | |
b15a901d | 230 | %service ejabberd stop |
fb70a56e JK |
231 | /sbin/chkconfig --del ejabberd |
232 | fi | |
67271627 JK |
233 | %systemd_preun %{name}.service |
234 | ||
235 | %postun | |
236 | %systemd_reload | |
237 | ||
238 | %triggerprein -- %{name} < 13.10 | |
7102eb90 JK |
239 | if [ -e /etc/jabber/ejabberd.cfg ] ; then |
240 | if grep -Eq '^[^%]*access_get' /etc/jabber/ejabberd.cfg ; then | |
241 | echo "Your 'ejabberd.cfg' config file seems to use 'access_get' option of mod_vcard" >&2 | |
242 | echo "this is not supported by this ejabberd version in PLD" >&2 | |
243 | exit 1 | |
244 | fi | |
245 | rm -f /etc/jabber/ejabberd.yml.rpmnew 2>/dev/null || : | |
246 | fi | |
247 | if [ -e /var/lock/subsys/ejabberd ] ; then | |
67271627 JK |
248 | # old init script won't stop ejabberd correctly |
249 | # stop it's all processes here | |
250 | # we assume any 'epmd', 'beam', 'beam.smp' or 'heart' process | |
251 | # running with uid of jabber is ejabberd process | |
252 | pids="$(ps -C "epmd beam beam.smp heart" -o pid=,user= | awk '/jabber/ { print $1 }')" || : | |
253 | if [ -n "$pids" ] ; then | |
254 | %banner -e %{name} <<'EOF' | |
255 | Killing all 'epmd, beam, beam.smp, heart' processed owned by the 'jabber' user to make sure old ejabberd is down. | |
7102eb90 | 256 | |
67271627 JK |
257 | EOF |
258 | kill $pids || : | |
259 | fi | |
260 | fi | |
7102eb90 | 261 | touch /var/run/%{name}-upgrade-trigger || : |
fb70a56e | 262 | |
fcf4c7a2 JK |
263 | %triggerpostun -- %{name} < 13.10 |
264 | # convert old 'NODENAME' in /etc/sysconfig/ejabberd | |
265 | # to 'ERLANG_NODE' in /etc/jabber/ejabberdctl.cfg | |
266 | # and move other settings | |
267 | NODENAME="$(hostname)" | |
268 | if [ -e /etc/sysconfig/ejabberd ] ; then | |
269 | . /etc/sysconfig/ejabberd || : | |
270 | fi | |
271 | subst="s/^#ERLANG_NODE=.*/ERLANG_NODE=ejabberd@${NODENAME}/" | |
7102eb90 JK |
272 | if [ "$NODENAME" != "localhost" ] ; then |
273 | %banner -e %{name} <<'EOF' | |
274 | Configured node name (ejabberd@${NODENAME}) is not at 'localhost'. | |
275 | – setting INET_DIST_INTERFACE=0.0.0.0 in /etc/jabber/ejabberdctl.cfg. | |
276 | You should consider tuning that or your firewall configuration. | |
277 | ||
278 | EOF | |
279 | subst="$subst;s/^#INET_DIST_INTERFACE=.*/INET_DIST_INTERFACE=0.0.0.0/" | |
280 | fi | |
fcf4c7a2 JK |
281 | if [ -n "$ERL_MAX_PORTS" ] ; then |
282 | subst="$subst;s/^#ERL_MAX_PORTS=.*/ERL_MAX_PORTS=${ERL_MAX_PORTS}/" | |
283 | fi | |
284 | sed -i -e"$subst" /etc/jabber/ejabberdctl.cfg || : | |
285 | if [ -e /etc/sysconfig/ejabberd ] ; then | |
286 | sed -i.rpmsave \ | |
287 | -e'/^[#[:space:]]*NODENAME=/d;/^# Node name/d' \ | |
288 | -e'/^[#[:space:]]*ERL_MAX_PORTS=/d;/^# uncomment this to allow more then 1024 connections/d' \ | |
289 | -e'/^[#[:space:]]*ERL_FULLSWEEP_AFTER=/d;/^# uncomment this to limit memory usage/d' \ | |
290 | /etc/sysconfig/ejabberd || : | |
291 | fi | |
292 | cp %{_sysconfdir}/jabber/cookie /var/lib/ejabberd/.erlang.cookie || : | |
7102eb90 JK |
293 | chown jabber:jabber /var/lib/ejabberd/.erlang.cookie || : |
294 | chmod 400 /var/lib/ejabberd/.erlang.cookie || : | |
295 | if [ -e /etc/jabber/ejabberd.cfg -a ! -e /etc/jabber/ejabberd.yml.rpmnew ] ; then | |
296 | mv /etc/jabber/ejabberd.yml /etc/jabber/ejabberd.yml.rpmnew | |
297 | echo 'include_config_file: "/etc/jabber/ejabberd.cfg"' > /etc/jabber/ejabberd.yml || : | |
298 | fi | |
299 | ||
300 | # post action postponed here | |
301 | %service ejabberd restart "ejabberd server" | |
302 | %systemd_post %{name}.service | |
303 | ||
67271627 | 304 | %systemd_trigger %{name}.service |
fcf4c7a2 | 305 | |
fb70a56e JK |
306 | %files |
307 | %defattr(644,root,root,755) | |
e2bda3a7 | 308 | %doc sql _doc/* |
fb70a56e | 309 | %attr(755,root,root) %{_sbindir}/* |
fcf4c7a2 JK |
310 | %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd-inetrc |
311 | %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.yml | |
312 | %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberdctl.cfg | |
313 | # legacy config may still be there | |
314 | %attr(640,root,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.cfg | |
67ffd871 | 315 | %attr(770,root,jabber) /var/log/ejabberd |
61f3ef21 | 316 | %if %{with logdb} |
cba58599 | 317 | %exclude %{_libdir}/ejabberd/ebin/mod_logdb* |
61f3ef21 | 318 | %endif |
fb70a56e JK |
319 | %{_libdir}/ejabberd |
320 | %dir %attr(770,root,jabber) /var/lib/ejabberd | |
fcf4c7a2 | 321 | %ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie |
d798517a JK |
322 | %attr(754,root,root) /etc/rc.d/init.d/%{name} |
323 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} | |
67271627 | 324 | %{systemdunitdir}/%{name}.service |
cba58599 | 325 | |
61f3ef21 | 326 | %if %{with logdb} |
cba58599 | 327 | %files logdb |
328 | %defattr(644,root,root,755) | |
329 | %{_libdir}/ejabberd/ebin/mod_logdb* | |
61f3ef21 | 330 | %endif |