# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit java-pkg eutils webapp DESCRIPTION="A Collaboration and Integration Server Environment" HOMEPAGE="http://www.open-xchange.org/" SRC_URI="http://mirror.open-xchange.org/download/${P}.tar.bz2" LICENSE="GPL-2" KEYWORDS="~x86" IUSE="ssl webdav" S="${WORKDIR}/${PN}.${PV}" DEPEND=">=virtual/jdk-1.4 >=dev-java/java-config-1.2 dev-java/sun-javamail-bin sys-apps/findutils sys-apps/sed net-www/webapp-config dev-java/jdbc3-postgresql dev-java/jdom dev-java/servletapi ssl? ( dev-libs/openssl )" RDEPEND=">=virtual/jdk-1.4 >=dev-java/java-config-1.2 dev-perl/perl-ldap www-servers/tomcat dev-perl/Net-SSLeay dev-java/jdbc3-postgresql dev-java/jdom dev-db/postgresql net-nds/openldap dev-perl/mod_perl app-text/ispell" pkg_setup() { FAIL=0 if [ -z "${OX_DBNAME}" ] ; then einfo " " ewarn "The environment \$OX_DBNAME was not set. I will take the default" ewarn "value 'openexchange'." einfo " " OX_DBNAME="openexchange" FAIL=1 fi if [ -z "${OX_DBUSER}" ] ; then einfo " " ewarn "The environment \$OX_DBUSER was not set. I will take the default" ewarn "value 'openexchange'." einfo " " OX_DBUSER="openexchange" FAIL=1 fi if [ -z "${OX_DBPASS}" ] ; then einfo " " ewarn "The environment \$OX_DBPASS was not set. I will take the default" ewarn "value 'xxx'." einfo " " OX_DBPASS="xxx" FAIL=1 fi if [ ${FAIL} -eq 1 ] ; then ewarn "If you dont want to use the default values then hit " ewarn "to cancel and set the environment before emerging open-xchange." einfo " " echo -ne " >>> " for TICKER in 1 2 3 4 5 6 7 8; do # Double beep here. echo -ne "$TICKER " echo -ne "\a" ; sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null echo -ne "\a" ; sleep 1 done sleep 5 echo " " fi webapp_pkg_setup } src_unpack() { unpack ${A} ; cd ${S} rm -rf ${S}/autom4te.cache aclocal -I m4/ && autoconf || die "reconfigure failed" } src_compile() { local myconf if use webdav ; then myconf="${myconf} $(use_enable webdav)" fi if use ssl ; then myconf="${myconf} $(use_enable ssl)" fi ./configure \ --with-mailjar=${ROOT}/usr/share/sun-javamail-bin/lib/mail.jar \ --with-activationjar=${ROOT}/usr/share/sun-jaf-bin/lib/activation.jar \ --with-jsdkjar=${ROOT}/usr/share/servletapi-2.4/lib/servlet-api.jar \ --with-jdbcjar=${ROOT}/usr/share/jdbc3-postgresql-1/lib/pg73jdbc3.jar \ --with-jdomjar=${ROOT}/usr/share/jdom/lib/jdom.jar \ --with-xercesjar=${ROOT}/usr/share/xerces-2/lib/xercesImpl.jar \ --with-dbname=${OX_DBNAME} \ --with-dbuser=${OX_DBUSER} \ --with-dbpass=${OX_DBPASS} \ --with-runuid=apache \ --with-rungid=apache \ --with-htdocsdir=/open-xchange \ --with-cgibindir=/open-xchange \ ${myconf} \ --sysconfdir=${D}etc/open-xchange \ --infodir=${D}usr/share/open-xchange \ --datadir=${D}usr/share/open-xchange \ --includedir=${D}usr/include/open-xchange \ --infodir=${D}usr/info \ --mandir=${D}usr/man \ --libdir=${D}usr/lib/open-xchange \ --localstatedir=${D}var/open-xchange \ --prefix=${D} || die "bad ./configure" # replace the string "jikes" with "modern". We dont want to see all jikes warnings sed -i "s|jikes|modern|g" build.xml make || die "make failed" # cut the WORKDIR url from the config files, needed this otherwise it will install in /usr/local/open-xchange find lib/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; find bin/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; find sbin/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; find system/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; find webmail/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; find groupware/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; find src/misc/login/ -type f -name login.pm -exec sed -i "s|${D}|/|g" \{\} \; find conf/ -type f ! -name '*.in' -exec sed -i "s|${D}|/|g" \{\} \; # Replace css, javascrip and images path in htm files find webmail/ -type f ! -name '*.in*' -exec sed -i "s|/cfintranet|/open-xchange/cfintranet|g" \{\} \; find groupware/ -type f ! -name '*.in' -exec sed -i "s|/cfintranet|/open-xchange/cfintranet|g" \{\} \; find system/www/groupware/javascript/ -type f ! -name '*.in' -exec sed -i "s|/cfintranet|/open-xchange/cfintranet|g" \{\} \; find system/www/webmail/javascript/ -type f ! -name '*.in' -exec sed -i "s|/cfintranet|/open-xchange/cfintranet|g" \{\} \; # create user mailadmin, needed for mailsupport enewuser mailadmin -1 -1 /dev/null users _UID=`getent passwd mailadmin | awk -F : '{print $3}'` # get the default guid of the group 'users' OX_STDGID=`getent group users | awk -F : '{print $3}'` # replace the SuSE group id 500 of users with the gentoo group id of the group 'users' for the mailadmin in ldif + uid sed -i "s|500|${OX_STDGID}|g" system/setup/init_ldap.ldif sed -i "s|501|${_UID}|g" system/setup/init_ldap.ldif # replace the SuSE standard group id 500 with the gentoo group id of the group 'users' sed -i "s|500|${OX_STDGID}|g" conf/admintools.conf OX_STDGID=`expr ${OX_STDGID} + 1` sed -i "s|501|${OX_STDGID}|g" conf/admintools.conf } src_install() { webapp_src_preinst dodoc AUTHORS ChangeLog INSTALL NEWS README # copy all images, css and javascript dodir ${MY_HTDOCSDIR}/cfintranet/ dodir ${MY_HTDOCSDIR}/cfintranet/webmail cd system/www/groupware cp -r css images javascript ${D}${MY_HTDOCSDIR}/cfintranet/. cd ../webmail cp -r css images javascript ${D}${MY_HTDOCSDIR}/cfintranet/webmail/. # Install this big thing cd ${S} make install || die "Failed on make install" # copy jar java-pkg_dojar ${D}usr/lib/open-xchange/comfiretools.jar java-pkg_dojar ${D}usr/lib/open-xchange/intranet.jar java-pkg_dojar ${D}usr/lib/open-xchange/nas.jar java-pkg_dojar ${D}usr/lib/open-xchange/sessiond.jar java-pkg_dojar ${D}usr/lib/open-xchange/webmail.jar webapp_serverowned ${MY_HTDOCSDIR} # Init script exeinto /etc/init.d insopts -m0755 newexe ${D}etc/open-xchange/init.d/openexchange openexchange # Copy rest of cgi scripts cd ${D} insinto ${MY_CGIBINDIR} insopts -m0755 newins ${D}usr/share/open-xchange/perl/login.pl login.pl newins ${D}usr/share/open-xchange/perl/login.pm login.pm # Install webapp webapp_src_install } pkg_postinst() { webapp_pkg_postinst chgrp -R apache /var/open-xchange/* einfo " " einfo " " einfo " ===========================================================" einfo " " einfo " You have successfully installed Open-Xchange" einfo " " einfo " ===========================================================" einfo " " einfo " o FILE LOCATIONS" einfo " 1. Configuration: /etc/open-xchange" einfo " 2. HTML Files: /usr/share/open-xchange" einfo " " einfo " o STARTING and STOPPING the Open-Xchange" einfo " /etc/init.d/openexchange start" einfo " /etc/init.d/openexchange stop" einfo " /etc/init.d/openexchange restart" einfo " " einfo "Execute the following command" einfo "ebuild /var/db/pkg/www-apps/${PF}/${PF}.ebuild config" einfo "to setup the initial open-xchange environment." einfo " " } pkg_config() { ln -s /etc/openldap/ldap.conf /etc/open-xchange/groupware/ldap.conf ln -s /etc/openldap/ldap.conf /etc/open-xchange/webmail/ldap.conf correctfilespool }