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