# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils ssl-cert DESCRIPTION="The Erlang Jabber Daemon" HOMEPAGE="http://ejabberd.jabber.ru/" SRC_URI="http://www.process-one.net/en/projects/ejabberd/download/${PV}/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86 ~amd64 ~sparc" IUSE="mod_pubsub mod_irc mod_muc ldap web ssl" DEPEND=">=dev-libs/expat-1.95 >=dev-lang/erlang-10.2.0 ssl? ( >=dev-libs/openssl-0.9.6 )" PROVIDE="virtual/jabber-server" S=${WORKDIR}/${P}/src/ DESTDIR=${D} create_user() { enewgroup jabber || die "problem adding group jabber" enewuser ejabberd -1 /bin/false /var/run/ejabberd jabber || die "problem adding user ejabberd" } src_compile() { local myconf use mod_pubsub || myconf="--disable-mod_pubsub" use mod_irc || myconf="${myconf} --disable-mod_irc" use mod_muc || myconf="${myconf} --disable-mod_muc" use ldap || myconf="${myconf} --disable-eldap" use web || myconf="${myconf} --disable-web" use ssl || myconf="${myconf} --disable-tls" econf ${myconf} || die emake || die "emake failed" } src_install() { dodir /var/{spool,run,log}/ejabberd fowners ejabberd:jabber /var/{log,run,spool}/ejabberd fperms 700 /var/spool/ejabberd make DESTDIR=${DESTDIR} install || die "install failed" # This configuration file contains configurations for all modules, # including ones that were potentially not built due to USE flags, # so we'll have to move it out of the way so it isn't accidentally # used. mv ${DESTDIR}/etc/ejabberd/ejabberd.cfg ${DESTDIR}/etc/ejabberd/ejabberd.cfg.example cd .. dodoc doc/*.{tex,txt} dohtml doc/*.{html,png} dobin ${FILESDIR}/{ejabberdctl,ejabberd} exeinto /etc/init.d newexe ${FILESDIR}/ejabberd-0.7.5.initd ejabberd if use ssl ; then insinto /etc/ejabberd docert ssl rm -f ${DESTDIR}/etc/ejabberd/ssl.{crt,csr,key} fowners ejabberd:jabber /etc/ejabberd/ssl.pem fi insinto /etc/conf.d newins ${FILESDIR}/ejabberd-0.7.5.confd ejabberd # This file is required to make ejabberd use SRV records for # server-to-server connections, according to # insinto /etc/ejabberd doins ${FILESDIR}/inetrc } pkg_setup() { if [ -d /var/spool/ejabberd ] then ewarn "Migration from previous version is pretty straightforward as Mnesia database schema" ewarn "conversion is handled automatically. However, be warned that it's better to backup your" ewarn "existing ejabberd database before migration." ewarn "" ewarn "I give you the chance of hitting Ctrl-C and backup ejabberd database now." ebeep fi create_user } pkg_preinst() { create_user } pkg_postinst() { if [ ! -e /etc/ejabberd/ejabberd.cfg ] then einfo "A sample configuration file has been installed in /etc/ejabberd/ejabberd.cfg.example." einfo "Please copy it to /etc/ejabberd/ejabberd.cfg and edit it according to your needs." einfo "For configuration instructions, please see /usr/share/doc/${PF}/html/guide.html" else einfo "Since the format of the configuration file has been changed, its older version will no" einfo "longer work. You should replace the \"host\" directive in the ejabberd.cfg with new" einfo "directive \"hosts\", as in example below:" einfo "Before:" einfo " {host, \"localhost\"}." einfo "After:" einfo " {hosts, [\"localhost\"]}." einfo "For additional details, refer to /usr/share/doc/${PF}/release_notes_${PV}.txt." fi if use !web ; then einfo "The web USE flag is off, this will disable the web admin interface," einfo "if his was not the intention then add web ut your USE flags." fi }