89 lines
2.3 KiB
Bash
89 lines
2.3 KiB
Bash
# copyright (c) 2014 migmedia
|
|
EAPI="5"
|
|
|
|
inherit eutils java-pkg-2
|
|
|
|
DESCRIPTION="Artifactory Maven Artifact Server"
|
|
HOMEPAGE="http://www.jfrog.org/products.php"
|
|
|
|
SLOT="0"
|
|
RESTRICT="mirror"
|
|
SRC_URI="mirror://sourceforge/${PN}/${P}.zip"
|
|
KEYWORDS="~amd64 ~x86"
|
|
|
|
LICENSE="LGPL-3"
|
|
IUSE="mysql postgres"
|
|
|
|
RDEPEND="virtual/jre:1.7
|
|
>=www-servers/tomcat-7.0.52
|
|
dev-java/jsr305
|
|
mysql? ( dev-java/jdbc-mysql )
|
|
"
|
|
DEPEND="virtual/jdk:1.7
|
|
>=www-servers/tomcat-7.0.52
|
|
dev-java/jsr305
|
|
mysql? ( dev-java/jdbc-mysql )
|
|
"
|
|
|
|
ARTIFACTORY_HOME=/var/lib/${PN}
|
|
ARTIFACTORY_USER=artifact
|
|
TOMCAT_SUFFIX=${ARTIFACTORY_USER}
|
|
CONTAINER=/var/lib/tomcat-7-$TOMCAT_SUFFIX
|
|
|
|
pkg_setup() {
|
|
enewgroup artifact
|
|
enewuser ${ARTIFACTORY_USER} -1 /bin/sh -1 artifact
|
|
if [[ ! -d /etc/tomcat-7-${TOMCAT_SUFFIX} ]] ; then
|
|
/usr/share/tomcat-7/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 -m775 -o ${ARTIFACTORY_USER} -g artifact
|
|
keepdir ${ARTIFACTORY_HOME}/backup
|
|
keepdir ${ARTIFACTORY_HOME}/data
|
|
keepdir ${ARTIFACTORY_HOME}/work
|
|
keepdir ${ARTIFACTORY_HOME}/etc
|
|
keepdir /var/log/artifactory
|
|
|
|
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}\""
|
|
}
|