1 |
commit: eff5ee3fe2f381b192022af3fa25f1d02241dd7c |
2 |
Author: Amadeusz Żołnowski <aidecoe <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 9 20:12:45 2017 +0000 |
4 |
Commit: Amadeusz Piotr Żołnowski <aidecoe <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 9 20:14:05 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eff5ee3f |
7 |
|
8 |
net-im/ejabberd: Remove older revisions of 17.01 |
9 |
|
10 |
Package-Manager: Portage-2.3.6, Repoman-2.3.2 |
11 |
|
12 |
net-im/ejabberd/ejabberd-17.01-r1.ebuild | 324 ------------------------------- |
13 |
net-im/ejabberd/ejabberd-17.01.ebuild | 322 ------------------------------ |
14 |
2 files changed, 646 deletions(-) |
15 |
|
16 |
diff --git a/net-im/ejabberd/ejabberd-17.01-r1.ebuild b/net-im/ejabberd/ejabberd-17.01-r1.ebuild |
17 |
deleted file mode 100644 |
18 |
index 7bada46b7dc..00000000000 |
19 |
--- a/net-im/ejabberd/ejabberd-17.01-r1.ebuild |
20 |
+++ /dev/null |
21 |
@@ -1,324 +0,0 @@ |
22 |
-# Copyright 1999-2017 Gentoo Foundation |
23 |
-# Distributed under the terms of the GNU General Public License v2 |
24 |
- |
25 |
-EAPI=6 |
26 |
- |
27 |
-SSL_CERT_MANDATORY=1 |
28 |
- |
29 |
-inherit eutils pam rebar ssl-cert systemd |
30 |
- |
31 |
-DESCRIPTION="Robust, scalable and extensible XMPP server" |
32 |
-HOMEPAGE="http://www.ejabberd.im/ https://github.com/processone/ejabberd/" |
33 |
-SRC_URI="http://www.process-one.net/downloads/${PN}/${PV}/${P}.tgz |
34 |
- -> ${P}.tar.gz" |
35 |
- |
36 |
-LICENSE="GPL-2" |
37 |
-SLOT="0" |
38 |
-KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~sparc ~x86" |
39 |
-REQUIRED_USE="mssql? ( odbc )" |
40 |
-# TODO: Add 'tools' flag. |
41 |
-IUSE="captcha debug full-xml hipe ldap mssql mysql nls odbc pam postgres redis |
42 |
- riak roster-gw sqlite zlib" |
43 |
- |
44 |
-RESTRICT="test" |
45 |
- |
46 |
-# TODO: Add dependencies for 'tools' flag enabled. |
47 |
-# TODO: tools? ( |
48 |
-# TODO: >=dev-erlang/meck-0.8.4 |
49 |
-# TODO: >=dev-erlang/moka-1.0.5b |
50 |
-# TODO: ) |
51 |
-CDEPEND=" |
52 |
- >=dev-erlang/cache_tab-1.0.6 |
53 |
- >=dev-erlang/esip-1.0.10 |
54 |
- >=dev-erlang/fast_tls-1.0.10 |
55 |
- >=dev-erlang/fast_xml-1.1.19 |
56 |
- >=dev-erlang/fast_yaml-1.0.8 |
57 |
- >=dev-erlang/jiffy-0.14.8 |
58 |
- >=dev-erlang/lager-3.2.1 |
59 |
- >=dev-erlang/luerl-0.2 |
60 |
- >=dev-erlang/p1_oauth2-0.6.1 |
61 |
- >=dev-erlang/p1_utils-1.0.6 |
62 |
- >=dev-erlang/stringprep-1.0.7 |
63 |
- >=dev-erlang/stun-1.0.9 |
64 |
- >=dev-erlang/xmpp-1.1.6 |
65 |
- >=dev-lang/erlang-17.1[hipe?,odbc?,ssl] |
66 |
- >=net-im/jabber-base-0.01 |
67 |
- ldap? ( =net-nds/openldap-2* ) |
68 |
- mysql? ( >=dev-erlang/p1_mysql-1.0.2 ) |
69 |
- nls? ( >=dev-erlang/iconv-1.0.3 ) |
70 |
- odbc? ( dev-db/unixODBC ) |
71 |
- pam? ( >=dev-erlang/epam-1.0.0-r1 |
72 |
- <dev-erlang/epam-1.0.1 ) |
73 |
- postgres? ( >=dev-erlang/p1_pgsql-1.1.2 ) |
74 |
- redis? ( >=dev-erlang/eredis-1.0.8 ) |
75 |
- riak? ( |
76 |
- >=dev-erlang/hamcrest-0.1.0_p20150103 |
77 |
- >=dev-erlang/riakc-2.4.1 |
78 |
- ) |
79 |
- sqlite? ( >=dev-erlang/sqlite3-1.1.5 ) |
80 |
- zlib? ( >=dev-erlang/ezlib-1.0.2 )" |
81 |
-DEPEND="${CDEPEND} |
82 |
- >=sys-apps/gawk-4.1" |
83 |
-RDEPEND="${CDEPEND} |
84 |
- captcha? ( media-gfx/imagemagick[truetype,png] )" |
85 |
- |
86 |
-DOCS=( README ) |
87 |
-PATCHES=( "${FILESDIR}/${P}-ejabberdctl.patch" |
88 |
- "${FILESDIR}/${P}-0001-Dont-overwrite-service-file.patch" ) |
89 |
- |
90 |
-EJABBERD_CERT="${EPREFIX}/etc/ssl/ejabberd/server.pem" |
91 |
-# Paths in net-im/jabber-base |
92 |
-JABBER_ETC="${EPREFIX}/etc/jabber" |
93 |
-JABBER_LOG="${EPREFIX}/var/log/jabber" |
94 |
-JABBER_SPOOL="${EPREFIX}/var/spool/jabber" |
95 |
- |
96 |
-# Adjust example configuration file to Gentoo. |
97 |
-# - Use our sample certificates. |
98 |
-# - Correct PAM service name. |
99 |
-adjust_config() { |
100 |
- sed -e "s|\"/path/to/ssl.pem\"|\"${EJABBERD_CERT}\"|g" \ |
101 |
- -e "s|\"pamservicename\"|\"xmpp\"|" \ |
102 |
- -i "${S}/ejabberd.yml.example" \ |
103 |
- || die 'failed to adjust example config' |
104 |
-} |
105 |
- |
106 |
-# Set paths to ejabberd lib directory consistently to point always to directory |
107 |
-# suffixed with version. |
108 |
-correct_ejabberd_paths() { |
109 |
- sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${P}:}" \ |
110 |
- -i "${S}/Makefile.in" \ |
111 |
- || die 'failed to set ejabberd path in Makefile.in' |
112 |
- sed -e "/EJABBERD_BIN_PATH=/{s:ejabberd:${P}:}" \ |
113 |
- -i "${S}/ejabberdctl.template" \ |
114 |
- || die 'failed to set ejabberd path in ejabberdctl.template' |
115 |
- sed -e 's|\(captcha_cmd:[[:space:]]*"\).\+"|\1'$(get_ejabberd_path)'/priv/bin/captcha.sh"|' \ |
116 |
- -i "${S}/ejabberd.yml.example" \ |
117 |
- || die 'failed to correct path to captcha.sh in example config' |
118 |
-} |
119 |
- |
120 |
-# Get epam-wrapper from 'files' directory and correct path to lib directory in |
121 |
-# it. epam-wrapper is placed into work directory. It is assumed no epam-wrapper |
122 |
-# file exists there already. |
123 |
-customize_epam_wrapper() { |
124 |
- local epam_wrapper_src="$1" |
125 |
- local epam_wrapper_dst="${S}/epam-wrapper" |
126 |
- |
127 |
- [[ -e ${epam_wrapper_dst} ]] && die 'epam-wrapper already exists' |
128 |
- sed -r -e "s@^(ERL_LIBS=).*\$@\1${EPREFIX}$(get_erl_libs)@" \ |
129 |
- "${epam_wrapper_src}" >"${epam_wrapper_dst}" \ |
130 |
- || die 'failed to install epam-wrapper' |
131 |
-} |
132 |
- |
133 |
-# Disable mod_irc in example configuration file. |
134 |
-disable_mod_irc() { |
135 |
- local needs_iconv='needs dev-erlang/iconv (+nls USE flag)' |
136 |
- sed -r \ |
137 |
- -e "s@^(\s*)(mod_irc\s*:.*$)@\1## \2 # ${needs_iconv}@" \ |
138 |
- -i "${S}/ejabberd.yml.example" \ |
139 |
- || die 'failed to modify example config' |
140 |
-} |
141 |
- |
142 |
-# Check if there already exists a certificate. |
143 |
-ejabberd_cert_exists() { |
144 |
- local cert |
145 |
- |
146 |
- for cert in $(gawk -- \ |
147 |
- 'match($0, /^[[:space:]]*certfile: "([^"]+)"/, m) {print m[1];}' \ |
148 |
- "${EROOT%/}${JABBER_ETC}/ejabberd.yml"); do |
149 |
- [[ -f ${cert} ]] && return 0 |
150 |
- done |
151 |
- |
152 |
- return 1 |
153 |
-} |
154 |
- |
155 |
-# Generate and install sample ejabberd certificate. It's installed into |
156 |
-# EJABBERD_CERT path. |
157 |
-ejabberd_cert_install() { |
158 |
- SSL_ORGANIZATION="${SSL_ORGANIZATION:-ejabberd XMPP Server}" |
159 |
- install_cert "${EJABBERD_CERT%.*}" |
160 |
- chown root:jabber "${EROOT%/}${EJABBERD_CERT}" || die |
161 |
- chmod 0440 "${EROOT%/}${EJABBERD_CERT}" || die |
162 |
-} |
163 |
- |
164 |
-# Get path to ejabberd lib directory. |
165 |
-# |
166 |
-# This is the path ./configure script Base for this path is path set in |
167 |
-# ./configure script which is /usr/lib by default. If libdir is explicitely set |
168 |
-# to something else than this should be adjusted here as well. |
169 |
-get_ejabberd_path() { |
170 |
- echo "/usr/$(get_libdir)/${P}" |
171 |
-} |
172 |
- |
173 |
-# Check whether mod_irc is enabled in ejabberd configuration on target system. |
174 |
-is_mod_irc_enabled() { |
175 |
- egrep '^(\s*)(mod_irc\s*:.*$)' \ |
176 |
- "${EROOT%/}${JABBER_ETC}/ejabberd.yml" |
177 |
-} |
178 |
- |
179 |
-# Make ejabberd.service for systemd from upstream provided template. |
180 |
-make_ejabberd_service() { |
181 |
- sed -r \ |
182 |
- -e 's!@ctlscriptpath@!/usr/sbin!g' \ |
183 |
- -e 's!(User|Group)=(.*)!\1=jabber!' \ |
184 |
- "${PN}.service.template" >"${PN}.service" \ |
185 |
- || die 'failed to make ejabberd.service' |
186 |
-} |
187 |
- |
188 |
-# Set paths to defined by net-im/jabber-base. |
189 |
-set_jabberbase_paths() { |
190 |
- sed -e "/^ETCDIR[[:space:]]*=/{s:@sysconfdir@/ejabberd:${JABBER_ETC}:}" \ |
191 |
- -e "/^LOGDIR[[:space:]]*=/{s:@localstatedir@/log/ejabberd:${JABBER_LOG}:}" \ |
192 |
- -e "/^SPOOLDIR[[:space:]]*=/{s:@localstatedir@/lib/ejabberd:${JABBER_SPOOL}:}" \ |
193 |
- -i "${S}/Makefile.in" \ |
194 |
- || die 'failed to set paths in Makefile.in' |
195 |
- sed -e "s|\(ETC_DIR=\){{sysconfdir}}.*|\1${JABBER_ETC}|" \ |
196 |
- -e "s|\(LOGS_DIR=\){{localstatedir}}.*|\1${JABBER_LOG}|" \ |
197 |
- -e "s|\(SPOOL_DIR=\){{localstatedir}}.*|\1${JABBER_SPOOL}|" \ |
198 |
- -i "${S}/ejabberdctl.template" \ |
199 |
- || die 'failed to set paths ejabberdctl.template' |
200 |
-} |
201 |
- |
202 |
-# Skip installing docs because it's only COPYING that's installed by Makefile. |
203 |
-skip_docs() { |
204 |
- gawk -i inplace ' |
205 |
-/# Documentation/, /^[[:space:]]*#?[[:space:]]*$/ { |
206 |
- if ($0 ~ /^[[:space:]]*#?[[:space:]]*$/) { |
207 |
- print $0; |
208 |
- } else { |
209 |
- next; |
210 |
- } |
211 |
-} |
212 |
-1 |
213 |
-' "${S}/Makefile.in" || die 'failed to remove docs section from Makefile.in' |
214 |
-} |
215 |
- |
216 |
-pkg_setup() { |
217 |
- if use pam; then |
218 |
- einfo "Adding jabber user to epam group to allow ejabberd to use PAM" \ |
219 |
- "authentication" |
220 |
- # See |
221 |
- # <https://docs.ejabberd.im/admin/configuration/#pam-authentication>. |
222 |
- # epam binary is installed by dev-erlang/epam package, therefore SUID |
223 |
- # is set by that package. Instead of jabber group it uses epam group, |
224 |
- # therefore we need to add jabber user to epam group. |
225 |
- usermod -a -G epam jabber || die |
226 |
- fi |
227 |
-} |
228 |
- |
229 |
-src_prepare() { |
230 |
- default |
231 |
- |
232 |
- rebar_remove_deps |
233 |
- correct_ejabberd_paths |
234 |
- set_jabberbase_paths |
235 |
- make_ejabberd_service |
236 |
- skip_docs |
237 |
- adjust_config |
238 |
- use nls || disable_mod_irc |
239 |
- customize_epam_wrapper "${FILESDIR}/epam-wrapper" |
240 |
- |
241 |
- rebar_fix_include_path fast_xml |
242 |
- rebar_fix_include_path xmpp |
243 |
- |
244 |
- # Fix bug #591862. ERL_LIBS should point directly to ejabberd directory |
245 |
- # rather than its parent which is default. That way ejabberd directory |
246 |
- # takes precedence is module lookup. |
247 |
- local ejabberd_erl_libs="$(get_ejabberd_path):$(get_erl_libs)" |
248 |
- sed -e "s|\(ERL_LIBS=\){{libdir}}.*|\1${ejabberd_erl_libs}|" \ |
249 |
- -i "${S}/ejabberdctl.template" \ |
250 |
- || die 'failed to set ERL_LIBS in ejabberdctl.template' |
251 |
-} |
252 |
- |
253 |
-src_configure() { |
254 |
- econf \ |
255 |
- --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
256 |
- --enable-user=jabber \ |
257 |
- $(use_enable debug) \ |
258 |
- $(use_enable full-xml) \ |
259 |
- $(use_enable hipe) \ |
260 |
- $(use_enable mssql) \ |
261 |
- $(use_enable mysql) \ |
262 |
- $(use_enable nls iconv) \ |
263 |
- $(use_enable odbc) \ |
264 |
- $(use_enable pam) \ |
265 |
- $(use_enable postgres pgsql) \ |
266 |
- $(use_enable redis) \ |
267 |
- $(use_enable riak) \ |
268 |
- $(use_enable roster-gw roster-gateway-workaround) \ |
269 |
- $(use_enable sqlite) \ |
270 |
- $(use_enable zlib) |
271 |
-} |
272 |
- |
273 |
-src_compile() { |
274 |
- emake REBAR='rebar -v' src |
275 |
-} |
276 |
- |
277 |
-src_install() { |
278 |
- default |
279 |
- |
280 |
- if use pam; then |
281 |
- local epam_path="$(get_ejabberd_path)/priv/bin/epam" |
282 |
- |
283 |
- pamd_mimic_system xmpp auth account || die "cannot create pam.d file" |
284 |
- into "$(get_ejabberd_path)/priv" |
285 |
- newbin epam-wrapper epam |
286 |
- fi |
287 |
- |
288 |
- newconfd "${FILESDIR}/${PN}.confd" "${PN}" |
289 |
- newinitd "${FILESDIR}/${PN}.initd" "${PN}" |
290 |
- systemd_dounit "${PN}.service" |
291 |
- systemd_dotmpfilesd "${FILESDIR}/${PN}.tmpfiles.conf" |
292 |
- |
293 |
- insinto /etc/logrotate.d |
294 |
- newins "${FILESDIR}/${PN}.logrotate" "${PN}" |
295 |
-} |
296 |
- |
297 |
-pkg_postinst() { |
298 |
- if [[ ! ${REPLACING_VERSIONS} ]]; then |
299 |
- echo |
300 |
- elog "For configuration instructions, please see" |
301 |
- elog " http://www.process-one.net/en/ejabberd/docs/" |
302 |
- echo |
303 |
- if [[ " ${REPLACING_VERSIONS} " =~ \ 2\. ]]; then |
304 |
- ewarn "If you have used pubsub in ejabberd-2.* you may encounter issues after" |
305 |
- ewarn "migration to ${PV}. pubsub data may not be migrated automatically and" |
306 |
- ewarn "you may need to run migration script manually, see:" |
307 |
- ewarn |
308 |
- ewarn " https://github.com/processone/ejabberd/issues/479#issuecomment-124497456" |
309 |
- ewarn |
310 |
- ewarn "In case you don't care about all stored moods, activities, geoinfo and you" |
311 |
- ewarn "know you don't store in pubsub anything important, you can just remove" |
312 |
- ewarn "pubsub tables:" |
313 |
- ewarn |
314 |
- ewarn " rm ${EROOT%/}${JABBER_SPOOL}/pubsub_*" |
315 |
- ewarn |
316 |
- ewarn "See also: https://bugs.gentoo.org/show_bug.cgi?id=588244" |
317 |
- echo |
318 |
- fi |
319 |
- elif [[ -f ${EROOT}etc/jabber/ejabberd.cfg ]]; then |
320 |
- elog "Ejabberd now defaults to using a YAML format for its config file." |
321 |
- elog "The old ejabberd.cfg file can be converted using the following instructions:" |
322 |
- echo |
323 |
- elog "1. Make sure all processes related to the previous version of ejabberd aren't" |
324 |
- elog " running. Usually this just means the ejabberd and epmd daemons and possibly" |
325 |
- elog " the pam-related process (epam) if pam support is enabled." |
326 |
- elog "2. Run \`ejabberdctl start\` with sufficient permissions. Note that this can" |
327 |
- elog " fail to start ejabberd properly for various reasons. Check ejabberd's main" |
328 |
- elog " log file at /var/log/jabber/ejabberd.log to confirm it started successfully." |
329 |
- elog "3. Run" |
330 |
- elog " \`ejabberdctl convert_to_yaml /etc/jabber/ejabberd.cfg /etc/jabber/ejabberd.yml.new\`" |
331 |
- elog " with sufficient permissions, edit and rename /etc/jabber/ejabberd.yml.new to" |
332 |
- elog " /etc/jabber/ejabberd.yml, and finally restart ejabberd with the new config" |
333 |
- elog " file." |
334 |
- echo |
335 |
- fi |
336 |
- |
337 |
- if ! ejabberd_cert_exists; then |
338 |
- ejabberd_cert_install |
339 |
- fi |
340 |
- |
341 |
- if ! use nls && is_mod_irc_enabled; then |
342 |
- ewarn "nls support (dev-erlang/iconv) is required by mod_irc. Either rebuild ejabberd" |
343 |
- ewarn "with nls enabled or disable mod_irc in ${EROOT%/}${JABBER_ETC}/ejabberd.yml." |
344 |
- fi |
345 |
-} |
346 |
|
347 |
diff --git a/net-im/ejabberd/ejabberd-17.01.ebuild b/net-im/ejabberd/ejabberd-17.01.ebuild |
348 |
deleted file mode 100644 |
349 |
index 061059b6183..00000000000 |
350 |
--- a/net-im/ejabberd/ejabberd-17.01.ebuild |
351 |
+++ /dev/null |
352 |
@@ -1,322 +0,0 @@ |
353 |
-# Copyright 1999-2017 Gentoo Foundation |
354 |
-# Distributed under the terms of the GNU General Public License v2 |
355 |
- |
356 |
-EAPI=6 |
357 |
- |
358 |
-SSL_CERT_MANDATORY=1 |
359 |
- |
360 |
-inherit eutils pam rebar ssl-cert systemd |
361 |
- |
362 |
-DESCRIPTION="Robust, scalable and extensible XMPP server" |
363 |
-HOMEPAGE="http://www.ejabberd.im/ https://github.com/processone/ejabberd/" |
364 |
-SRC_URI="http://www.process-one.net/downloads/${PN}/${PV}/${P}.tgz |
365 |
- -> ${P}.tar.gz" |
366 |
- |
367 |
-LICENSE="GPL-2" |
368 |
-SLOT="0" |
369 |
-KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~sparc ~x86" |
370 |
-REQUIRED_USE="mssql? ( odbc )" |
371 |
-# TODO: Add 'tools' flag. |
372 |
-IUSE="captcha debug full-xml hipe ldap mssql mysql nls odbc pam postgres redis |
373 |
- riak roster-gw sqlite zlib" |
374 |
- |
375 |
-RESTRICT="test" |
376 |
- |
377 |
-# TODO: Add dependencies for 'tools' flag enabled. |
378 |
-# TODO: tools? ( |
379 |
-# TODO: >=dev-erlang/meck-0.8.4 |
380 |
-# TODO: >=dev-erlang/moka-1.0.5b |
381 |
-# TODO: ) |
382 |
-CDEPEND=" |
383 |
- >=dev-erlang/cache_tab-1.0.6 |
384 |
- >=dev-erlang/esip-1.0.10 |
385 |
- >=dev-erlang/fast_tls-1.0.10 |
386 |
- >=dev-erlang/fast_xml-1.1.19 |
387 |
- >=dev-erlang/fast_yaml-1.0.8 |
388 |
- >=dev-erlang/jiffy-0.14.8 |
389 |
- >=dev-erlang/lager-3.2.1 |
390 |
- >=dev-erlang/luerl-0.2 |
391 |
- >=dev-erlang/p1_oauth2-0.6.1 |
392 |
- >=dev-erlang/p1_utils-1.0.6 |
393 |
- >=dev-erlang/stringprep-1.0.7 |
394 |
- >=dev-erlang/stun-1.0.9 |
395 |
- >=dev-erlang/xmpp-1.1.6 |
396 |
- >=dev-lang/erlang-17.1[hipe?,odbc?,ssl] |
397 |
- >=net-im/jabber-base-0.01 |
398 |
- ldap? ( =net-nds/openldap-2* ) |
399 |
- mysql? ( >=dev-erlang/p1_mysql-1.0.2 ) |
400 |
- nls? ( >=dev-erlang/iconv-1.0.3 ) |
401 |
- odbc? ( dev-db/unixODBC ) |
402 |
- pam? ( >=dev-erlang/epam-1.0.0 |
403 |
- <dev-erlang/epam-1.0.1 ) |
404 |
- postgres? ( >=dev-erlang/p1_pgsql-1.1.2 ) |
405 |
- redis? ( >=dev-erlang/eredis-1.0.8 ) |
406 |
- riak? ( |
407 |
- >=dev-erlang/hamcrest-0.1.0_p20150103 |
408 |
- >=dev-erlang/riakc-2.4.1 |
409 |
- ) |
410 |
- sqlite? ( >=dev-erlang/sqlite3-1.1.5 ) |
411 |
- zlib? ( >=dev-erlang/ezlib-1.0.2 )" |
412 |
-DEPEND="${CDEPEND} |
413 |
- >=sys-apps/gawk-4.1" |
414 |
-RDEPEND="${CDEPEND} |
415 |
- captcha? ( media-gfx/imagemagick[truetype,png] )" |
416 |
- |
417 |
-DOCS=( README ) |
418 |
-PATCHES=( "${FILESDIR}/${P}-ejabberdctl.patch" ) |
419 |
- |
420 |
-EJABBERD_CERT="${EPREFIX}/etc/ssl/ejabberd/server.pem" |
421 |
-# Paths in net-im/jabber-base |
422 |
-JABBER_ETC="${EPREFIX}/etc/jabber" |
423 |
-JABBER_LOG="${EPREFIX}/var/log/jabber" |
424 |
-JABBER_SPOOL="${EPREFIX}/var/spool/jabber" |
425 |
- |
426 |
-# Adjust example configuration file to Gentoo. |
427 |
-# - Use our sample certificates. |
428 |
-# - Correct PAM service name. |
429 |
-adjust_config() { |
430 |
- sed -e "s|\"/path/to/ssl.pem\"|\"${EJABBERD_CERT}\"|g" \ |
431 |
- -e "s|\"pamservicename\"|\"xmpp\"|" \ |
432 |
- -i "${S}/ejabberd.yml.example" \ |
433 |
- || die 'failed to adjust example config' |
434 |
-} |
435 |
- |
436 |
-# Set paths to ejabberd lib directory consistently to point always to directory |
437 |
-# suffixed with version. |
438 |
-correct_ejabberd_paths() { |
439 |
- sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${P}:}" \ |
440 |
- -i "${S}/Makefile.in" \ |
441 |
- || die 'failed to set ejabberd path in Makefile.in' |
442 |
- sed -e "/EJABBERD_BIN_PATH=/{s:ejabberd:${P}:}" \ |
443 |
- -i "${S}/ejabberdctl.template" \ |
444 |
- || die 'failed to set ejabberd path in ejabberdctl.template' |
445 |
- sed -e 's|\(captcha_cmd:[[:space:]]*"\).\+"|\1'$(get_ejabberd_path)'/priv/bin/captcha.sh"|' \ |
446 |
- -i "${S}/ejabberd.yml.example" \ |
447 |
- || die 'failed to correct path to captcha.sh in example config' |
448 |
-} |
449 |
- |
450 |
-# Get epam-wrapper from 'files' directory and correct path to lib directory in |
451 |
-# it. epam-wrapper is placed into work directory. It is assumed no epam-wrapper |
452 |
-# file exists there already. |
453 |
-customize_epam_wrapper() { |
454 |
- local epam_wrapper_src="$1" |
455 |
- local epam_wrapper_dst="${S}/epam-wrapper" |
456 |
- |
457 |
- [[ -e ${epam_wrapper_dst} ]] && die 'epam-wrapper already exists' |
458 |
- sed -r -e "s@^(ERL_LIBS=).*\$@\1${EPREFIX}$(get_erl_libs)@" \ |
459 |
- "${epam_wrapper_src}" >"${epam_wrapper_dst}" \ |
460 |
- || die 'failed to install epam-wrapper' |
461 |
-} |
462 |
- |
463 |
-# Disable mod_irc in example configuration file. |
464 |
-disable_mod_irc() { |
465 |
- local needs_iconv='needs dev-erlang/iconv (+nls USE flag)' |
466 |
- sed -r \ |
467 |
- -e "s@^(\s*)(mod_irc\s*:.*$)@\1## \2 # ${needs_iconv}@" \ |
468 |
- -i "${S}/ejabberd.yml.example" \ |
469 |
- || die 'failed to modify example config' |
470 |
-} |
471 |
- |
472 |
-# Check if there already exists a certificate. |
473 |
-ejabberd_cert_exists() { |
474 |
- local cert |
475 |
- |
476 |
- for cert in $(gawk -- \ |
477 |
- 'match($0, /^[[:space:]]*certfile: "([^"]+)"/, m) {print m[1];}' \ |
478 |
- "${EROOT%/}${JABBER_ETC}/ejabberd.yml"); do |
479 |
- [[ -f ${cert} ]] && return 0 |
480 |
- done |
481 |
- |
482 |
- return 1 |
483 |
-} |
484 |
- |
485 |
-# Generate and install sample ejabberd certificate. It's installed into |
486 |
-# EJABBERD_CERT path. |
487 |
-ejabberd_cert_install() { |
488 |
- SSL_ORGANIZATION="${SSL_ORGANIZATION:-ejabberd XMPP Server}" |
489 |
- install_cert "${EJABBERD_CERT%.*}" |
490 |
- chown root:jabber "${EROOT%/}${EJABBERD_CERT}" || die |
491 |
- chmod 0440 "${EROOT%/}${EJABBERD_CERT}" || die |
492 |
-} |
493 |
- |
494 |
-# Get path to ejabberd lib directory. |
495 |
-# |
496 |
-# This is the path ./configure script Base for this path is path set in |
497 |
-# ./configure script which is /usr/lib by default. If libdir is explicitely set |
498 |
-# to something else than this should be adjusted here as well. |
499 |
-get_ejabberd_path() { |
500 |
- echo "/usr/$(get_libdir)/${P}" |
501 |
-} |
502 |
- |
503 |
-# Check whether mod_irc is enabled in ejabberd configuration on target system. |
504 |
-is_mod_irc_enabled() { |
505 |
- egrep '^(\s*)(mod_irc\s*:.*$)' \ |
506 |
- "${EROOT%/}${JABBER_ETC}/ejabberd.yml" |
507 |
-} |
508 |
- |
509 |
-# Make ejabberd.service for systemd from upstream provided template. |
510 |
-make_ejabberd_service() { |
511 |
- sed -r \ |
512 |
- -e 's!@ctlscriptpath@!/usr/sbin!' \ |
513 |
- -e 's!(User|Group)=(.*)!\1=jabber!' \ |
514 |
- "${PN}.service.template" >"${PN}.service" \ |
515 |
- || die 'failed to make ejabberd.service' |
516 |
-} |
517 |
- |
518 |
-# Set paths to defined by net-im/jabber-base. |
519 |
-set_jabberbase_paths() { |
520 |
- sed -e "/^ETCDIR[[:space:]]*=/{s:@sysconfdir@/ejabberd:${JABBER_ETC}:}" \ |
521 |
- -e "/^LOGDIR[[:space:]]*=/{s:@localstatedir@/log/ejabberd:${JABBER_LOG}:}" \ |
522 |
- -e "/^SPOOLDIR[[:space:]]*=/{s:@localstatedir@/lib/ejabberd:${JABBER_SPOOL}:}" \ |
523 |
- -i "${S}/Makefile.in" \ |
524 |
- || die 'failed to set paths in Makefile.in' |
525 |
- sed -e "s|\(ETC_DIR=\){{sysconfdir}}.*|\1${JABBER_ETC}|" \ |
526 |
- -e "s|\(LOGS_DIR=\){{localstatedir}}.*|\1${JABBER_LOG}|" \ |
527 |
- -e "s|\(SPOOL_DIR=\){{localstatedir}}.*|\1${JABBER_SPOOL}|" \ |
528 |
- -i "${S}/ejabberdctl.template" \ |
529 |
- || die 'failed to set paths ejabberdctl.template' |
530 |
-} |
531 |
- |
532 |
-# Skip installing docs because it's only COPYING that's installed by Makefile. |
533 |
-skip_docs() { |
534 |
- gawk -i inplace ' |
535 |
-/# Documentation/, /^[[:space:]]*#?[[:space:]]*$/ { |
536 |
- if ($0 ~ /^[[:space:]]*#?[[:space:]]*$/) { |
537 |
- print $0; |
538 |
- } else { |
539 |
- next; |
540 |
- } |
541 |
-} |
542 |
-1 |
543 |
-' "${S}/Makefile.in" || die 'failed to remove docs section from Makefile.in' |
544 |
-} |
545 |
- |
546 |
-src_prepare() { |
547 |
- default |
548 |
- |
549 |
- rebar_remove_deps |
550 |
- correct_ejabberd_paths |
551 |
- set_jabberbase_paths |
552 |
- make_ejabberd_service |
553 |
- skip_docs |
554 |
- adjust_config |
555 |
- use nls || disable_mod_irc |
556 |
- customize_epam_wrapper "${FILESDIR}/epam-wrapper" |
557 |
- |
558 |
- rebar_fix_include_path fast_xml |
559 |
- rebar_fix_include_path xmpp |
560 |
- |
561 |
- # Fix bug #591862. ERL_LIBS should point directly to ejabberd directory |
562 |
- # rather than its parent which is default. That way ejabberd directory |
563 |
- # takes precedence is module lookup. |
564 |
- local ejabberd_erl_libs="$(get_ejabberd_path):$(get_erl_libs)" |
565 |
- sed -e "s|\(ERL_LIBS=\){{libdir}}.*|\1${ejabberd_erl_libs}|" \ |
566 |
- -i "${S}/ejabberdctl.template" \ |
567 |
- || die 'failed to set ERL_LIBS in ejabberdctl.template' |
568 |
-} |
569 |
- |
570 |
-src_configure() { |
571 |
- econf \ |
572 |
- --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
573 |
- --enable-user=jabber \ |
574 |
- $(use_enable debug) \ |
575 |
- $(use_enable full-xml) \ |
576 |
- $(use_enable hipe) \ |
577 |
- $(use_enable mssql) \ |
578 |
- $(use_enable mysql) \ |
579 |
- $(use_enable nls iconv) \ |
580 |
- $(use_enable odbc) \ |
581 |
- $(use_enable pam) \ |
582 |
- $(use_enable postgres pgsql) \ |
583 |
- $(use_enable redis) \ |
584 |
- $(use_enable riak) \ |
585 |
- $(use_enable roster-gw roster-gateway-workaround) \ |
586 |
- $(use_enable sqlite) \ |
587 |
- $(use_enable zlib) |
588 |
-} |
589 |
- |
590 |
-src_compile() { |
591 |
- emake REBAR='rebar -v' src |
592 |
-} |
593 |
- |
594 |
-src_install() { |
595 |
- default |
596 |
- |
597 |
- if use pam; then |
598 |
- local epam_path="$(get_ejabberd_path)/priv/bin/epam" |
599 |
- |
600 |
- pamd_mimic_system xmpp auth account || die "cannot create pam.d file" |
601 |
- into "$(get_ejabberd_path)/priv" |
602 |
- newbin epam-wrapper epam |
603 |
- # PAM helper module permissions |
604 |
- # https://www.process-one.net/docs/ejabberd/guide_en.html#pam |
605 |
- fowners root:jabber "${epam_path}" |
606 |
- fperms 4750 "${epam_path}" |
607 |
- fi |
608 |
- |
609 |
- newconfd "${FILESDIR}/${PN}.confd" "${PN}" |
610 |
- newinitd "${FILESDIR}/${PN}.initd" "${PN}" |
611 |
- systemd_dounit "${PN}.service" |
612 |
- systemd_dotmpfilesd "${FILESDIR}/${PN}.tmpfiles.conf" |
613 |
- |
614 |
- insinto /etc/logrotate.d |
615 |
- newins "${FILESDIR}/${PN}.logrotate" "${PN}" |
616 |
-} |
617 |
- |
618 |
-pkg_postinst() { |
619 |
- if [[ ! ${REPLACING_VERSIONS} ]]; then |
620 |
- echo |
621 |
- elog "For configuration instructions, please see" |
622 |
- elog " http://www.process-one.net/en/ejabberd/docs/" |
623 |
- echo |
624 |
- if [[ " ${REPLACING_VERSIONS} " =~ \ 2\. ]]; then |
625 |
- ewarn "If you have used pubsub in ejabberd-2.* you may encounter issues after" |
626 |
- ewarn "migration to ${PV}. pubsub data may not be migrated automatically and" |
627 |
- ewarn "you may need to run migration script manually, see:" |
628 |
- ewarn |
629 |
- ewarn " https://github.com/processone/ejabberd/issues/479#issuecomment-124497456" |
630 |
- ewarn |
631 |
- ewarn "In case you don't care about all stored moods, activities, geoinfo and you" |
632 |
- ewarn "know you don't store in pubsub anything important, you can just remove" |
633 |
- ewarn "pubsub tables:" |
634 |
- ewarn |
635 |
- ewarn " rm ${EROOT%/}${JABBER_SPOOL}/pubsub_*" |
636 |
- ewarn |
637 |
- ewarn "See also: https://bugs.gentoo.org/show_bug.cgi?id=588244" |
638 |
- echo |
639 |
- fi |
640 |
- elif [[ -f ${EROOT}etc/jabber/ejabberd.cfg ]]; then |
641 |
- elog "Ejabberd now defaults to using a YAML format for its config file." |
642 |
- elog "The old ejabberd.cfg file can be converted using the following instructions:" |
643 |
- echo |
644 |
- elog "1. Make sure all processes related to the previous version of ejabberd aren't" |
645 |
- elog " running. Usually this just means the ejabberd and epmd daemons and possibly" |
646 |
- elog " the pam-related process (epam) if pam support is enabled." |
647 |
- elog "2. Run \`ejabberdctl start\` with sufficient permissions. Note that this can" |
648 |
- elog " fail to start ejabberd properly for various reasons. Check ejabberd's main" |
649 |
- elog " log file at /var/log/jabber/ejabberd.log to confirm it started successfully." |
650 |
- elog "3. Run" |
651 |
- elog " \`ejabberdctl convert_to_yaml /etc/jabber/ejabberd.cfg /etc/jabber/ejabberd.yml.new\`" |
652 |
- elog " with sufficient permissions, edit and rename /etc/jabber/ejabberd.yml.new to" |
653 |
- elog " /etc/jabber/ejabberd.yml, and finally restart ejabberd with the new config" |
654 |
- elog " file." |
655 |
- echo |
656 |
- fi |
657 |
- |
658 |
- if ! ejabberd_cert_exists; then |
659 |
- ejabberd_cert_install |
660 |
- fi |
661 |
- |
662 |
- if use pam; then |
663 |
- # sfperms drops read bit from files with suid. Reapply it. |
664 |
- # Fix bug #592218. |
665 |
- local epam_path="$(get_ejabberd_path)/priv/bin/epam" |
666 |
- chmod g+r "${EROOT%/}${epam_path}" \ |
667 |
- || die "failed to correct ${epam_path} permissions" |
668 |
- fi |
669 |
- |
670 |
- if ! use nls && is_mod_irc_enabled; then |
671 |
- ewarn "nls support (dev-erlang/iconv) is required by mod_irc. Either rebuild ejabberd" |
672 |
- ewarn "with nls enabled or disable mod_irc in ${EROOT%/}${JABBER_ETC}/ejabberd.yml." |
673 |
- fi |
674 |
-} |