# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils MYP=${P/kolabd/kolabd-gentoo} DESCRIPTION="The kolab server" HOMEPAGE="http://www.kolab.org" SRC_URI="http://www.gunnarwrobel.de/downloads/${MYP}.tar.bz2" SLOT="0" LICENSE="GPL-2" KEYWORDS="~x86" IUSE="" DEPEND="" RDEPEND="mail-filter/spamassassin =net-www/mod_auth_ldap-2.4.2-r2 =dev-perl/perl-kolab-0.9.2 dev-perl/Net-Netmask dev-perl/URI dev-perl/perl-ldap dev-perl/TermReadKey net-ftp/proftpd =net-mail/cyrus-imapd-2.2.12-r3 >=mail-filter/amavisd-new-2.3.0 >=app-antivirus/clamav-0.85.1 >=net-nds/openldap-2.2.23-r1 =mail-mta/postfix-2.2.2-r3 =net-mail/kolab-resmgr-0.3.9 =net-mail/kolab-freebusy-0.3.9 =net-mail/kolab-webadmin-0.4.0 =net-www/apache-1* !=net-www/apache-2*" S=${WORKDIR} add_user_to_group() { ############################################################# # HACK: # I did not see any other ebuild that adds existing users # to new groups. So I'm not certain it is ok to handle it # like this since I need to disable the sandbox to access # the /etc/group file. # The given users need access to the ssl certificates which # is possible if they belong to kolab-r local oldsandbox=${SANDBOX_ON} export SANDBOX_ON="0" gpasswd -a $1 $2 export SANDBOX_ON=${oldsandbox} } pkg_setup() { if ! built_with_use cyrus-imapd kolab ssl ; then eerror "You MUST re-emerge cyrus-imapd with kolab" eerror "and ssl enabled. Please add both use flags" eerror "to your USE variable and re-emerge cyrus-imapd!" die "Current cyrus-imapd installation does not support Kolabd!" fi if ! built_with_use proftpd ssl ldap ; then eerror "You MUST re-emerge proftpd with ldap" eerror "and ssl enabled. Please add both use flags" eerror "to your USE variable and re-emerge proftpd!" die "Current proftpd installation does not support Kolabd!" fi if ! built_with_use postfix sasl ssl ldap ; then eerror "You MUST re-emerge postfix with ldap, sasl" eerror "and ssl enabled. Please add these use flags" eerror "to your USE variable and re-emerge postfix!" die "Current postfix installation does not support Kolabd!" fi if ! built_with_use openldap berkdb crypt perl sasl ssl ; then eerror "You MUST re-emerge openldap with berkdb, crypt, sasl" eerror "perl and ssl enabled. Please add these use flags" eerror "to your USE variable and re-emerge openldap!" die "Current openldap installation does not support Kolabd!" fi if ! built_with_use cyrus-sasl ldap ; then eerror "You MUST re-emerge cyrus-sasl with ldap support." eerror "Please add the ldap use flag" eerror "to your USE variable and re-emerge cyrus-sasl!" die "Current cyrus-sasl installation does not support Kolabd!" fi if ! built_with_use apache ssl ; then eerror "You MUST re-emerge apache with ssl support." eerror "Please add the ssl use flag" eerror "to your USE variable and re-emerge apache!" die "Current apache installation does not support Kolabd!" fi } src_unpack() { unpack ${A} && cd "${S}" rm Makefile ## Patching the code for gentoo cd kolabd for PATCH in ${FILESDIR}/kolabd-*.patch do epatch ${PATCH} done cd templates for PATCH in ${FILESDIR}/template-*.patch do epatch ${PATCH} done cp ${FILESDIR}/confd-* . cp ${FILESDIR}/{access,aliases,canonical,relocated}.template . cd .. } src_install() { cd ${S}/kolabd ############################################################# # Fix the scripts for cfile in * templates/* do if [ -f "${cfile}" ]; then sed -i -e "s/@l_prefix@//g" ${cfile} sed -i -e "s/@l_musr@/${musr}/g" ${cfile} sed -i -e "s/@l_rusr@/${rusr}/g" ${cfile} sed -i -e "s/@l_nusr@/${nusr}/g" ${cfile} sed -i -e "s/@l_muid@/${muid}/g" ${cfile} sed -i -e "s/@l_ruid@/${ruid}/g" ${cfile} sed -i -e "s/@l_nuid@/${nuid}/g" ${cfile} sed -i -e "s/@l_mgrp@/${musr}/g" ${cfile} sed -i -e "s/@l_rgrp@/${rusr}/g" ${cfile} sed -i -e "s/@l_ngrp@/${nusr}/g" ${cfile} sed -i -e "s/@l_mgid@/${mgid}/g" ${cfile} sed -i -e "s/@l_rgid@/${rgid}/g" ${cfile} sed -i -e "s/@l_ngid@/${ngid}/g" ${cfile} fi done ############################################################# # Create necessary directories local kolabdirs="/etc/kolab /etc/kolab/templates /var/lib/kolab /var/lib/kolab/log /var/lib/kolab/http_sessions /var/www/kolab/cgi-bin /var/www/kolab/locks /var/www/kolab/htdocs" for kdir in ${kolabdirs} do dodir ${kdir} fowners kolab:kolab ${kdir} done ############################################################# # Configuration in /etc/kolab # Scripts first insinto /etc/kolab local kolabetcscripts="kolab_bootstrap kolab_ca.sh kolabquotawarn kolab_smtpdpolicy kolab_sslcert.sh workaround.sh" insopts --mode=0755 --owner=kolab --group=kolab doins ${kolabetcscripts} ## FIXME: Do I need this? insopts --mode=0600 --owner=kolab --group=kolab doins kolab.conf insopts --mode=0644 --owner=kolab --group=kolab doins kolab.globals rootDSE.ldif insopts --mode=0644 --owner=kolab-n --group=kolab-n doins quotawarning.txt insinto /etc/kolab/templates insopts --mode=0644 --owner=kolab-n --group=kolab-n doins templates/*.template insinto /etc/init.d insopts --mode=0755 --owner=root --group=root doins ${FILESDIR}/kolabd ############################################################# # Configuration outside of /etc/kolab insopts --mode=0444 insinto /etc/openldap/schema doins rfc2739.schema kolab2.schema insopts --mode=0644 dodir /etc/amavisd/templates cp -r amavisd/* ${D}/etc/amavisd/templates chown -R amavis:amavis ${D}/etc/amavisd/templates ############################################################# # Executables ## FIXME: namespace/kolab? needed? dobin kolabpasswd dosbin kolabd kolabconf kolabcheckperm ############################################################# # Documentation dodoc ChangeLog doc/README.* ############################################################# # Users <-> Groups add_user_to_group ldap kolab-r add_user_to_group cyrus kolab-r add_user_to_group postfix kolab-r } pkg_postinst() { ## FIXME ewarn "You need to execute " ewarn "" ewarn "/etc/kolab/kolab_bootstrap -b" ewarn "" ewarn "to complete the kolab installation" }