# Copyright 2015 awesome information technology, http://awesome-it.de # Distributed under the terms of the GNU General Public License v3 # $Header: $ EAPI="5" inherit eutils git-2 EGIT_REPO_URI="https://git.kolab.org/diffusion/I/irony.git" [[ ${PV} == "9999" ]] || EGIT_COMMIT="iRony-${PV}" # Contains fixes for serious bugs in 0.2.6 release [[ ${PV} == "0.2.6" ]] && EGIT_COMMIT="16d0e127a1e9fb8399c841aad315466bff3d5a3a" DESCRIPTION="Kolab WebDAV/CalDAV/CardDAV Server" HOMEPAGE="http://kolab.org" LICENSE="AGPLv3+" KEYWORDS="~amd64" IUSE="+nginx" SLOT="0" DEPEND="virtual/httpd-php >=dev-lang/php-5.3.3 net-misc/curl www-apps/kolab-roundcube www-apps/kolab-chwala nginx? ( www-servers/nginx dev-lang/php[fpm] )" RDEPEND="${DEPEND}" IRONY_DIR="/usr/share/kolab-irony" IRONY_LOG_DIR="/var/log/kolab/irony" IRONY_CONF_DIR="/etc/kolab-irony" CHWALA_DIR="/usr/share/kolab-chwala" ROUNDCUBE_DIR="/usr/share/kolab-roundcube" ROUNDCUBE_CONF_DIR="/etc/kolab-roundcube" WWW_USER="nobody" use nginx && WWW_USER="nginx" src_prepare() { cd ${S} # Link required Roundcube libraries ln -s "${ROUNDCUBE_DIR}/plugins" "lib/plugins" ln -s "${ROUNDCUBE_DIR}/program/lib/Roundcube" "lib/Roundcube" # Link Roundcube's config ln -s "${ROUNDCUBE_CONF_DIR}/config.inc.php" "config/config.inc.php" ln -s "${ROUNDCUBE_CONF_DIR}/defaults.inc.php" "config/defaults.inc.php" # Copy dependencies from Chwala's file API. Make sure to not copy # chwala's lib/ext directory since this contains conflicting PEAR # libs. cp -a "${CHWALA_DIR}/lib" "lib/FileAPI" pushd "lib/FileAPI/ext/" rm -rf "Auth" "HTTP" "Mail" "Net" "PEAR5.php" "PEAR.php" "Roundcube" popd # Check whether there is remaining rate limit for github api. if test -z "$GITHUB_API_TOKEN" && curl -i -s https://api.github.com/rate_limit | grep -A5 rate | grep "\"remaining\": 0," &>/dev/null ; then eerror "Not enough rate limit for Github API available. Please specify a Github API key in GITHUB_API_TOKEN environment variable. " eerror "You can get your Github API token using: curl -u \"yourgithubname\" https://api.github.com/authorizations. " eerror "The remaining rate limit for unauthorized users can be displayed using: curl -i -s https://api.github.com/rate_limit" die "Unsufficient rate limit for Github API!" fi # Add Github token to composer file if [[ -n "$GITHUB_API_TOKEN" ]] ; then einfo "Using Github API token \"$GITHUB_API_TOKEN\" from environment variable GITHUB_API_TOKEN ..." sed -s "s#\"require-dev\": {#\"config\":{ \"github-oauth\":{ \"github.com\":\"$GITHUB_API_TOKEN\" } }, \"require-dev\": {#g" -i "composer.json" fi # Link Chwala's file API # Running PHP might create this addpredict /var/lib/net-snmp/mib_indexes # Set temp Composer home export COMPOSER_HOME="${S}/composer" elog "Installing vendor files using PHP composer, this can take a while ..." curl -sS http://getcomposer.org/installer | php -- --version=1.0.0-alpha8 &>/dev/null php composer.phar install || die "Error while installing vendor files." rm -rf $COMPOSER_HOME # Adopt config to this setup epatch "${FILESDIR}/dav.inc-${PV}.patch" } src_install() { dodir "${IRONY_CONF_DIR}" insinto "${IRONY_CONF_DIR}" newins "config/dav.inc.php.sample" "dav.inc.php" for c in $(ls config) ; do doins "config/$c" done rm -rf "config" ln -s "${IRONY_CONF_DIR}" "config" dodir "${IRONY_LOG_DIR}" fowners "${WWW_USER}" "${IRONY_LOG_DIR}" [[ -d logs ]] && rm -rf logs ln -s "${IRONY_LOG_DIR}" "logs" dodir "${IRONY_DIR}" insinto "${IRONY_DIR}" doins -r "public_html" doins -r "lib" doins -r "vendor" doins "config" doins "logs" dodir "${IRONY_DIR}/temp" fowners "${WWW_USER}" "${IRONY_DIR}/temp" if use nginx ; then insinto "/etc/nginx/conf.d" newins "${FILESDIR}/nginx.conf" "kolab-irony.conf" dodir "/etc/php/fpm.d" insinto "/etc/php/fpm.d" newins "${FILESDIR}/php-fpm.conf" "kolab-irony.conf" fi }