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