# 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/F/freebusy.git" [[ ${PV} == "9999" ]] || EGIT_COMMIT="${P}" DESCRIPTION="Kolab Free/Busy Web Presentation Layer" HOMEPAGE="http://kolab.org" LICENSE="AGPLv3+" KEYWORDS="~amd64" IUSE="" SLOT="0" DEPEND="net-misc/curl dev-lang/php[ldap] www-servers/nginx dev-lang/php[fpm] dev-php/composer" RDEPEND="${DEPEND}" FREEBUSY_DIR="/usr/share/kolab-freebusy" FREEBUSY_CONF_DIR="/etc/kolab-freebusy" FREEBUSY_LOG_DIR="/var/log/kolab/freebusy" ROUNDCUBE_DIR="/usr/share/kolab-roundcube" KOLAB_USER="kolab" WWW_USER="nginx" pkg_pretend() { # Check for Github API token if [[ -n "$GITHUB_API_TOKEN" ]] ; then einfo "Using Github API token \"$GITHUB_API_TOKEN\" from environment variable GITHUB_API_TOKEN ..." else eerror "Please specify a Github API key in GITHUB_API_TOKEN environment" eerror "variable to avoid exhausting the Github API limit when installing" eerror "vendor files using PHP's composer." eerror "You can manage your Github API tokens here: " eerror "https://github.com/settings/tokens" die "Please specify a Github API key in GITHUB_API_TOKEN environment variable!" fi } src_prepare() { cd ${S} # Link required Roundcube libraries ln -s "${ROUNDCUBE_DIR}/plugins" "lib/plugins" ln -s "${ROUNDCUBE_DIR}/program/lib/Roundcube" "lib/Roundcube" # Running PHP/composer might create this addpredict "/var/lib/net-snmp/mib_indexes" # Add Github API token to composer file composer config -g github-oauth.github.com $GITHUB_API_TOKEN # Apply patches for patch in $(ls ${FILESDIR}/${PN}-${PV}-*.patch) ; do epatch "${patch}" done elog "Installing vendor files using PHP composer, this can take a while ..." composer install || die "Error while installing vendor files." } src_install() { dodir "${FREEBUSY_CONF_DIR}" insinto "${FREEBUSY_CONF_DIR}" newins "config/config.ini.sample" "config.ini" rm -rf "config" ln -s "${FREEBUSY_CONF_DIR}" "config" dodir "${FREEBUSY_DIR}" insinto "${FREEBUSY_DIR}" doins -r "lib" doins -r "public_html" doins -r "vendor" doins "config" insinto "/etc/nginx/conf.d" newins "${FILESDIR}/nginx.conf" "kolab-freebusy.conf" dodir "/etc/php/fpm.d" insinto "/etc/php/fpm.d" newins "${FILESDIR}/php-fpm.conf" "kolab-freebusy.conf" keepdir "/var/lib/${PN}" fowners "${KOLAB_USER}" "/var/lib/${PN}" keepdir "/var/cache/${PN}" # TODO: Should be created at runtime dodir "${FREEBUSY_LOG_DIR}" fowners "${WWW_USER}" "${FREEBUSY_LOG_DIR}" [[ -d logs ]] && rm -rf logs ln -s "${FREEBUSY_LOG_DIR}" "logs" }