# copyright (c) 2014 migmedia EAPI="5" inherit eutils java-pkg-2 user DESCRIPTION="Artifactory Maven Artifact Server" HOMEPAGE="http://www.jfrog.org/products.php" MY_PN="artifactory-oss" SLOT="0" SRC_URI="https://bintray.com/artifact/download/jfrog/artifactory/jfrog-${MY_PN}-${PV}.zip" KEYWORDS="~amd64 ~x86" LICENSE="LGPL-3" IUSE="mysql postgres" RDEPEND="virtual/jre:1.7 >=www-servers/tomcat-8.0.00 dev-java/jsr305 mysql? ( dev-java/jdbc-mysql ) " DEPEND="virtual/jdk:1.7 >=www-servers/tomcat-8.0.00 dev-java/jsr305 mysql? ( dev-java/jdbc-mysql ) " ARTIFACTORY_HOME=/var/lib/${PN} ARTIFACTORY_USER=artifact TOMCAT_SUFFIX=${ARTIFACTORY_USER} CONTAINER=/var/lib/tomcat-8-$TOMCAT_SUFFIX S=${WORKDIR}/${MY_PN}-${PV} pkg_setup() { enewgroup artifact enewuser ${ARTIFACTORY_USER} -1 /bin/sh -1 artifact if [[ ! -d /etc/tomcat-8-${TOMCAT_SUFFIX} ]] ; then /usr/share/tomcat-8/gentoo/tomcat-instance-manager.bash --create --suffix ${TOMCAT_SUFFIX} \ --user ${ARTIFACTORY_USER} --group artifact fi } src_prepare() { edos2unix tomcat/conf/catalina.policy \ tomcat/conf/web.xml \ tomcat/conf/logging.properties \ tomcat/conf/Catalina/localhost/artifactory.xml sed -i -e "s!\${catalina.base}/logs!/var/log/tomcat-7-${TOMCAT_SUFFIX}!g" \ tomcat/conf/logging.properties sed -i -e "s!\${artifactory.home}!/var/lib/tomcat-7-${TOMCAT_SUFFIX}!g" \ tomcat/conf/Catalina/localhost/artifactory.xml } src_install() { diropts -m0775 -o ${ARTIFACTORY_USER} -g artifact keepdir ${ARTIFACTORY_HOME}/{backup,data,work,etc} keepdir /var/log/${PN} insinto ${CONTAINER}/webapps doins webapps/${PN}.war insinto ${CONTAINER}/conf doins tomcat/conf/catalina.policy doins tomcat/conf/web.xml doins tomcat/conf/logging.properties insinto ${CONTAINER}/conf/Catalina/localhost doins tomcat/conf/Catalina/localhost/artifactory.xml dosym /var/log/artifactory ${ARTIFACTORY_HOME}/logs insinto ${ARTIFACTORY_HOME}/etc doins etc/* elog "The default password for user 'admin' is 'password'." elog "Please change following parameters in /etc/conf.d/tomcat-${TOMCAT_SUFFIX}:" elog "TOMCAT_JVM=\"icedtea-7\", JAVA_OPTS=\"-Dartifactory.home=${ARTIFACTORY_HOME}\" and" local libs="" if use mysql; then libs=",jdbc-mysql" fi if use postgres; then libs="${libs},jdbc-postgresql" fi elog "TOMCAT_EXTRA_JARS=\"${libs:1}\"" }