# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ DESCRIPTION="Groupware server, built on apache, postfix, openldap and cyrus-imapd" # Homepage, not used by Portage directly but handy for developer reference HOMEPAGE="http://kolab.org/" # Point to any required sources; these will be automatically downloaded by # Portage. RPM_FILE="kolab-1.0-1.0.20" SRC_URI="http://www.erfrakon.de/projects/kolab/download/kolab-server-1.0/src/${RPM_FILE}.src.rpm" LICENSE="GPL" SLOT="0" KEYWORDS="~amd64" IUSE="" DEPEND="app-arch/rpm2targz net-mail/cyrus-imapd mail-mta/postfix net-www/apache dev-php/mod_php dev-perl/URI dev-perl/perl-ldap dev-perl/Net-Netmask dev-perl/File-NCopy dev-perl/TermReadKey net-nds/openldap net-mail/cyrus-imap-admin " # Run-time dependencies, same as DEPEND if RDEPEND isn't defined: #RDEPEND="" pkg_setup() { # Maybe we should not use a kolab user.. # kolab needs to be able to update the config file => runs as root? enewgroup kolab 95 enewuser kolab 95 /bin/false /var/kolab kolab } src_unpack() { cd ${WORKDIR} rpm2targz ${DISTDIR}/${RPM_FILE}.src.rpm || die "Failed to convert rpm 2 targz" tar xzvf ${RPM_FILE}.src.tar.gz || die "Failed untar targz" tar xzvf kolab-1.0.tar.gz || die "Failed untar second targz" epatch ${FILESDIR}/${P}-root_dir.patch || die "Failed to patch config files" cp ${FILESDIR}/${P}-init.d rc.kolab || die "Could not find kolab's init script" cp ${FILESDIR}/41_mod_ssl.default-vhost.conf.template . || die "Could not find kolab's init script" } src_compile() { cd ${WORKDIR} einfo "Replacing user:group settings in httpd.conf.template" sed -i -e 's;@l_nusr@;apache;g' httpd.conf.template || die "sed failed" sed -i -e 's;@l_ngrp@;apache;g' httpd.conf.template || die "sed failed" einfo "Replacing user:group settings in kolab_bootstrap" sed -i -e "s;@@@l_musr@@@;root;g" kolab_bootstrap || die "sed failed" sed -i -e "s;@@@l_rgrp@@@;root;g" kolab_bootstrap || die "sed failed" einfo "Replacing user:group settings in main.cf.template" sed -i -e "s;@@@l_musr@@@;postfix;g" main.cf.template || die "sed failed" sed -i -e "s;@@@l_rgrp@@@;postdrop;g" main.cf.template || die "sed failed" sed -i -e "s;@@@l_nusr@@@;nobody;g" main.cf.template || die "sed failed" einfo "Replacing user:group settings in proftpd.conf.template" sed -i -e 's;@@@l_nusr@@@;proftpd;g' proftpd.conf.template || die "sed failed" sed -i -e 's;@@@l_nuid@@@;ldap;g' proftpd.conf.template || die "sed failed" sed -i -e 's;@@@l_ngrp@@@;proftpd;g' proftpd.conf.template || die "sed failed" sed -i -e 's;@@@l_ngid@@@;ldap;g' proftpd.conf.template || die "sed failed" } src_install() { cd ${WORKDIR} dodir /etc/conf.d cp ${FILESDIR}/${P}-conf.d ${D}/etc/conf.d/kolab || die "Could not find ${FILESDIR}/${P}-conf.d" dodir /etc/kolab fperms 755 /etc/kolab dodir /etc/imapd fperms 755 /etc/imapd dodir /var/kolab/ dodir /var/kolab/log fperms 750 /var/kolab/log dodir /var/www/localhost/htdocs/cgi-bin fperms 750 /var/www/localhost/htdocs/cgi-bin dodir /var/www/localhost/htdocs/freebusy fperms 775 /var/www/localhost/htdocs/freebusy dodir /var/www/localhost/htdocs/icons dodir /var/www/localhost/htdocs/locks fperms 775 /var/www/localhost/htdocs/locks dodir /var/www/localhost/htdocs/webcalendar fperms 775 /var/www/localhost/htdocs/webcalendar exeinto /etc/init.d/ cp rc.kolab ${D}/etc/init.d/kolab fperms 755 /etc/init.d/kolab # gets overwritten later #install -c -m 740 kolab_sslcert.sh ${D}/etc/kolab/ insinto /etc/kolab/ for x in *.template *.conf *.schema; do doins $x && fperms 640 /etc/kolab/$x || die "Error while installing $x" done exeinto /etc/kolab/ for x in kolab kolab_bootstrap workaround.sh kolab_sslcert.sh; do doexe $x || die "Error while installing $x" done fperms 0600 /etc/kolab/kolab.conf || die "could not set perms" fperms 0600 /etc/kolab/main.cf.template || die "could not set perms" # install -c -m 640 proftpd.group.template ${D}/etc/kolab/ # install -c -m 640 proftpd.passwd.template ${D}/etc/kolab/ cp -r admin/ ${D}/var/www/localhost/htdocs/ chown kolab:kolab ${D}/var/www/localhost/htdocs/freebusy chown kolab:kolab ${D}/var/www/localhost/htdocs/locks } pkg_postinst() { einfo ewarn "Look at all .template files in /etc/kolab/ these files will replace your system configuration!" ewarn "Try to merge your previous configuration into these template files, before proceeding" einfo einfo "For a fresh install please initialize Kolab and run /etc/kolab/kolab_bootstrap -b' as user root." einfo "If you upgraded from a previous version simply refresh Kolab and run '/etc/kolab/kolab -o -v' as user root." einfo "In every case execute '/etc/init.d/kolab restart' as user root." }