# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=5 DESCRIPTION="Solr is a standalone enterprise search server with a REST-like API." HOMEPAGE="http://lucene.apache.org/solr/" SRC_URI="mirror://apache/lucene/${PN}/${PV}/${P}.tgz" LICENSE="apache2" SLOT="0" KEYWORDS="~amd64" IUSE="examples doc" DEPEND=" || ( virtual/jre:1.7 virtual/jre:1.8 ) " RDEPEND="${DEPEND}" INSTALL_DIR=/usr/share/${P} VAR_DIR=/var/lib/${PN} LOG_DIR=/var/log/${PN} USR=${PN} GRP=${PN} pkg_preinst() { enewgroup ${GRP} enewuser ${USR} -1 /bin/false /dev/null ${GRP} } src_prepare() { sed_expr="s#solr.log=.*#solr.log=${LOG_DIR}#" sed -i -e "$sed_expr" server/resources/log4j.properties echo "SOLR_PID_DIR=/run/${PN} SOLR_HOME=$VAR_DIR/data LOG4J_PROPS=$VAR_DIR/log4j.properties SOLR_LOGS_DIR=$LOG_DIR " >> bin/solr.in.sh sed_vard="s!/var/solr!${VAR_DIR}!" sed_usrd="s!/usr/share/solr!${INSTALL_DIR}!" # PID-dir into /run/solr/ sed_pidd="s!SOLR_PID_DIR=\"\$SOLR_TIP/bin\"!SOLR_PID_DIR=\"/run/${PN}\"!" # replace linkname in script sed_post="s!\(echo \".*\)\$THIS_SCRIPT!\1solr_post!" sed -i -e "$sed_vard" -e "$sed_usrd" -e "$sed_pidd" -e "$sed_post" bin/solr bin/post # Temp-Dir to /var/tmp/solr # /solr-webapp sed_tmpd="s!\(\).*\(\)!\1/var/tmp/solr\2!" sed -i -e "$sed_tmpd" server/contexts/solr-jetty-context.xml rmdir server/logs server/solr-webapp } src_install() { insinto ${INSTALL_DIR}/ INSTALL_DIR=/usr/share/${P} doins -r contrib dist server licenses use examples && doins -r example use doc && dohtml -r docs/* exeinto ${INSTALL_DIR}/bin/ doexe bin/solr bin/post dosym ..${INSTALL_DIR}/bin/solr /bin/solr dosym ..${INSTALL_DIR}/bin/post /bin/solr_post newinitd ${FILESDIR}/solr.init.d ${PN} newconfd ${FILESDIR}/solr.conf.d ${PN} insopts -o ${USR} -g ${GRP} -m644 diropts -o ${USR} -g ${GRP} keepdir ${LOG_DIR}/ keepdir /run/solr/ insinto ${VAR_DIR} fowners ${USR}:${GRP} ${VAR_DIR} doins bin/solr.in.sh doins server/resources/log4j.properties insinto ${VAR_DIR}/data/ fowners ${USR}:${GRP} ${VAR_DIR}/data doins server/solr/solr.xml }