# 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="git://git.kolab.org/git/${PN}" [[ ${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" 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 get your Github API token using: " eerror "$ curl -u \"yourgithubname\" https://api.github.com/authorizations." die "Please specify a Github API key in GITHUB_API_TOKEN environment variable!" fi } src_unpack() { git-2_src_unpack cd ${S} # https://issues.kolab.org/show_bug.cgi?id=2772 epatch "${FILESDIR}/${P}-fix-2772.patch" # https://issues.kolab.org/show_bug.cgi?id=2955 epatch "${FILESDIR}/${P}-fix-2955.patch" } src_prepare() { cd ${S} # Running PHP/composer might create this addpredict "/var/lib/net-snmp/mib_indexes" # Add Github API token to composer file sed -s "s#\"require-dev\": {#\"config\":{ \"github-oauth\":{ \"github.com\":\"$GITHUB_API_TOKEN\" } }, \"require-dev\": {#g" -i "composer.json" 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 "web" doins -r "vendor" doins "config" insinto "/etc/nginx/conf.d" newins "${FILESDIR}/${P}-nginx.conf" "kolab-freebusy.conf" dodir "/etc/php/fpm.d" insinto "/etc/php/fpm.d" newins "${FILESDIR}/php-fpm.conf" "kolab-freebusy.conf" }