# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils mailer DESCRIPTION="Advanced multiprotocol messaging and collaboration server" HOMEPAGE="http://www.citadel.org/" SRC_URI="http://easyinstall.citadel.org/${P}.tar.gz" RESTRICT="primaryuri" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86 ~ppc ~sparc" IUSE="ldap ssl zlib pam" S=${WORKDIR}/${PN} MESSAGEBASE="/var/lib/citadel" #should I bring in the calendar use flag? DEPEND=">=dev-libs/libical-0.26.6 >=sys-devel/autoconf-2.53 >=sys-libs/db-4.1.25_p1 ldap? ( >=net-nds/openldap-2.0.27 ) ssl? ( >=dev-libs/openssl-0.9.6 ) zlib? ( >=sys-libs/zlib-1.1.4 ) pam? ( sys-libs/pam )" pkg_setup() { #Create the user/group that the sever will run as. #Homedir needs to be the same as --with-datadir einfo "Adding Citadel User/Group" enewgroup citadel 175 enewuser citadel 175 /dev/null ${MESSAGEBASE} citadel } src_compile() { #Directory locations borrowed from citadel/debian/rules econf \ --prefix=/usr/sbin \ --with-sysconfdir=/etc/citadel \ --with-spooldir=/var/spool/citadel \ --with-datadir=${MESSAGEBASE} \ --with-rundir=/var/run/citadel \ --with-docdir=/usr/share/doc/${PF}/ \ $(use_with pam) \ $(use_with ssl openssl) \ $(use_with zlib) \ $(use_with ldap) \ --with-libical \ --with-db \ --enable-autologin \ || die "./configure failed" #emake server utils || die "make failed" #Tried this. However, it still makes client binaries. emake || die "make failed" } pkg_preinst() { #The EBuild howto says to repeat pkg_setup() as we are adding a user... einfo "Adding Citadel User/Group" enewgroup citadel 175 enewuser citadel 175 /dev/null ${MESSAGEBASE} citadel } src_install() { if use pam ; then dodir /etc/pam.d fi make root=${D} install-new || die "make install failed" #Protect ${MESSAGEBASE} echo CONFIG_PROTECT=${MESSAGEBASE} > ${T}/10citadel doenvd ${T}/10citadel #Keep emerge from removing empty directories when updating keepdir ${MESSAGEBASE}/data keepdir /var/spool/citadel/network/systems keepdir /var/spool/citadel/network/spoolout keepdir /var/spool/citadel/network/spoolin keepdir /var/run/citadel/network/systems keepdir /var/run/citadel/network/spoolout keepdir /var/run/citadel/network/spoolin #Remove the client files #Emerge net-mail/citadel-client to get them back rm ${D}/usr/bin/citadel rm ${D}/etc/citadel/citadel.rc #/usr/sbin is a bad place to keep a generic setup #Debian puts it in /usr/lib/citadel-server #However, /usr/lib is for programs that are run by programs mv ${D}/usr/sbin/setup ${D}/usr/sbin/citsetup #Fix some permissions fowners citadel:citadel /etc/citadel /var/lib/citadel #Work around some sendmail problems rm ${D}/usr/sbin/sendmail fowners root:citadel /usr/sbin/citmail fperms 4755 /usr/sbin/citmail if use mailwrapper ; then mailer_install_conf else dodir /usr/lib dosym /usr/sbin/citmail /usr/lib/sendmail dosym /usr/sbin/citmail /usr/sbin/sendmail fi if use ldap ; then insinto /etc/openldap/schema doins openldap/citadel.schema doins openldap/rfc2739.schema fi prepall prepalldocs } pkg_postinst() { einfo einfo "You might want to run:" einfo "\"emerge --config =${CATEGORY}/${PF}\"" einfo "if this is a new install." einfo } pkg_config() { #Citadel's setup uses a few enviromental variables to control it. #Read techdoc/package-setup.txt for information # export CITADEL_INSTALLER="yes" #Citadel alternate location. Just leave blank... export CITADEL="" #Is citadel the MTA? if use mailwrapper ; then export ACT_AS_MTA="no" else export ACT_AS_MTA="yes" fi #Don't create the inittab entry. We'll create it latter export CREATE_INITTAB_ENTRY="no" export CREATE_XINETD_ENTRY="no" #Warn user of possible bugs in setup... #ewarn "Be sure to set the Server port number to 504" #/usr/sbin/citsetup -q will create the config using defaults and enviromental variables. #However, there are just too many questions I don't want to have answered in make.conf /usr/sbin/citsetup #Verify the /etc/services entry was made if [ -f /etc/services ] && ! grep -q '^citadel' /etc/services ; then echo "citadel 504/tcp # citadel" >> /etc/services fi #citsetup creates the wrong path for citserver. #We'll create the /etc/inittab entry here if [ -f /etc/inittab ] ; then grep -v 'citserver' /etc/inittab >/etc/inittab.new && \ echo "cit1:2345:respawn:/usr/sbin/citserver -x5 -lmail" >> /etc/inittab.new && \ mv -f /etc/inittab.new /etc/inittab /sbin/init q fi einfo "Citadel has been started." einfo einfo "Be sure to read the documentation in /usr/share/doc/${PF}" einfo "You will also want a client installed somewhere in your net:" einfo "net-mail/citadel-client provides a text client" einfo "www-apps/webcit provides a web-based client" einfo } pkg_prerm() { if [ -f /etc/inittab ] ; then grep -v 'citserver' < /etc/inittab > /etc/inittab.new && \ mv -f /etc/inittab.new /etc/inittab /sbin/init q fi }