# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Heade: Exp $ inherit eutils webapp IUSE="mysql postgres" [[ "${PR}" == "r0" ]] && MY_PR="-${PR/r/}" || MY_PR="" DESCRIPTION="Web-based that glues topnotch mailing technologies like cyrus-imap and postfix together." SRC_URI="http://www.${PN}.org/${PN}-${PV}${MY_PR}.tar.gz" RESTRICT="nomirror" HOMEPAGE="http://www.web-cyradm.org/" LICENSE="GPL-2" KEYWORDS="x86 ~ppc sparc hppa" DEPEND=">=mail-mta/postfix-2.0.11 >=net-mail/cyrus-imapd-2.1.12 mysql? ( >=dev-db/mysql-3.23.51 >=sys-libs/pam_mysql-0.4.7 ) postgres? ( >=dev-db/postgresql-7.1 >=sys-libs/pam_pgsql-0.5.2-r5 ) virtual/php" RDEPEND="${DEPEND} sys-apps/sed" src_unpack() { unpack ${A} cd ${S} # Remove .cvs* files and CVS directories find ${S} -name .cvs\* -or \( -type d -name CVS -prune \) -exec rm -rf {} \; # Rename the config file mv -f config/conf.php.dist config/conf.php } src_compile() { :; } src_install() { webapp_src_preinst local docs="COPYRIGHT ChangeLog README README.translations TO-BE-DONE doc/Postfix-Cyrus-Web-cyradm-HOWTO.txt" # handle documentation files # # NOTE that doc files go into /usr/share/doc as normal; they do NOT # get installed per vhost! dodoc ${docs} for foo in ${docs} INSTALL; do rm -f ${foo} done dohtml doc/html/* && rm -rf doc # install the SQL scripts available to us # if use mysql; then # Because of limitations in the webapp ECLASS we need to merge the # insertuser SQL scripts into one file # SQL Scripts: # create_mysql.sql # insertuser_mysql.sql # upgrade-0.5.2-to-0.5.3_mysql.sql # upgrade-0.5.3-to-0.5.4_mysql.sql cp ${S}/scripts/insertuser_mysql.sql ${T}/merged_mysql.sql echo >>${T}/merged_mysql.sql sed -n "s/^create database/USE/gIp" ${S}/scripts/insertuser_mysql.sql >>${T}/merged_mysql.sql echo >>${T}/merged_mysql.sql cat ${S}/scripts/create_mysql.sql >>${T}/merged_mysql.sql webapp_sqlscript mysql ${T}/merged_mysql.sql webapp_sqlscript mysql ${S}/scripts/upgrade-0.5.3-to-0.5.4_mysql.sql 0.5.3 elif use postgres; then # Because of limitations in the webapp ECLASS we need to merge the # insertuser SQL scripts into one file. # SQL Scripts: # create_pgsql.sql # insertuser_pgsql.sql # upgrade-0.5.3-to-0.5.4_pgsql.sql cp ${S}/scripts/insertuser_pgsql.sql ${T}/merged_pgsql.sql echo >>${T}/merged_pgsql.sql sed -n "s/^create database/USE/gIp" ${S}/scripts/insertuser_pgsql.sql >>${T}/merged_pgsql.sql echo >>${T}/merged_pgsql.sql cat ${S}/scripts/create_pgsql.sql >>${T}/merged_pgsql.sql webapp_sqlscript pgsql ${T}/merged_pgsql.sql webapp_sqlscript pgsql ${S}/scripts/upgrade-0.5.3-to-0.5.4_pgsql.sql 0.5.3 fi # copy the app's main files # einfo "Installing main files" cp *.php ${D}${MY_HTDOCSDIR} cp -R css ${D}${MY_HTDOCSDIR} cp -R images ${D}${MY_HTDOCSDIR} cp -R lib ${D}${MY_HTDOCSDIR} cp -R locale ${D}${MY_HTDOCSDIR} cp -R config ${D}${MY_HTDOCSDIR} # Identify the configuration files that this app uses # webapp_configfile ${MY_HTDOCSDIR}/config/conf.php # Identify any script files that need #! headers adding to run under # a CGI script (such as PHP/CGI) # for foo in $(find . -iregex '.*\.php' -not -iregex '\./lib/.*' -not -iregex '.*\.inc\.php' -not -iregex '\./scripts/.*' -not -iregex '\./doc/.*' -print) ; do webapp_runbycgibin php ${MY_HTDOCSDIR}/${foo} done # fix owner # webapp_serverowned ${MY_HTDOCSDIR} find ${D}${MY_HTDOCSDIR} -type d -not -perm 755 -exec chmod 755 {} \; find ${D}${MY_HTDOCSDIR} -type f -not -perm 644 -exec chmod 644 {} \; # add the post-installation instructions # webapp_postinst_txt en ${FILESDIR}/postinstall-en.txt # all done # # now we let the eclass strut its stuff ;-) # webapp_src_install }