EAPI=2 inherit eutils 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 derby postgres" RDEPEND=">=virtual/jre-1.5" DEPEND=">=virtual/jdk-1.5 dev-java/jsr305 mysql? ( dev-java/jdbc-mysql ) " ARTIFACTORY_HOME=/var/lib/${PN} ARTIFACTORY_INSTALL=/usr/share/${PN} ARTIFACTORY_USER=artifact pkg_setup() { enewgroup artifact enewuser ${ARTIFACTORY_USER} -1 /bin/sh -1 artifact } src_install() { cd "${S}/bin" ls | grep -E "\.(bat|exe)" | xargs rm || die "remove failed" dodir ${ARTIFACTORY_HOME} dodir ${ARTIFACTORY_INSTALL} diropts -m775 -o ${ARTIFACTORY_USER} -g artifact keepdir /etc/artifactory keepdir /etc/artifactory/plugins/ keepdir ${ARTIFACTORY_HOME}/ keepdir ${ARTIFACTORY_HOME}/data/ keepdir ${ARTIFACTORY_HOME}/work/ keepdir ${ARTIFACTORY_HOME}/backup/ keepdir /var/log/artifactory/ keepdir /var/run/artifactory/ keepdir /var/tmp/artifactory/ dosym /var/log/artifactory ${ARTIFACTORY_HOME}/logs dosym /etc/artifactory ${ARTIFACTORY_HOME}/etc CONFIG=${D}/etc/artifactory/default echo "#!/bin/bash" >> ${CONFIG} echo "#export ARTIFACTORY_CONSOLE=/var/logs/artifactoy/consoleout.log" >> ${CONFIG} echo "#export JAVA_HOME=$(java-config --jre-home)" >> ${CONFIG} echo "export ARTIFACTORY_HOME=${ARTIFACTORY_HOME}" >> ${CONFIG} echo "export ARTIFACTORY_USER=${ARTIFACTORY_USER}" >> ${CONFIG} # remove unneeded configs rm -r ${S}/etc/repo/*mssql rm -r ${S}/etc/repo/*oracle* if ! use derby; then rm -r ${S}/etc/repo/*derby fi if ! use mysql; then rm -r ${S}/etc/repo/*mysql fi if ! use postgres; then rm -r ${S}/etc/repo/*postgresql fi chown ${ARTIFACTORY_USER}:artifact ${S}/etc/repo # remove windows-wrapper rm ${S}/lib/wrapper* sed -i -e "s:/webapps:${ARTIFACTORY_INSTALL}/webapps:" "${S}"/etc/jetty.xml sed -i -e "s:/logs:/var/log/artifactory:" "${S}"/etc/jetty.xml cd "${S}" cp -pPR clilib lib webapps ${PN}.jar "${D}${ARTIFACTORY_INSTALL}" || die "failed to copy libs" cp -pPR etc/* "${D}/etc/artifactory" || die "failed to copy conf" sed -i -e "s:CLI_DIR=\`dirname \$0\`:CLI_DIR=${ARTIFACTORY_INSTALL}/clilib:" "${S}"/bin/artadmin sed -i -e "s:\`dirname \"\$0\"\`\/\.\.:${ARTIFACTORY_INSTALL}:" "${S}"/bin/artifactory.sh exeinto /usr/bin doexe bin/artadmin newinitd "${FILESDIR}"/artifactory.initd artifactory newconfd "${FILESDIR}"/artifactory.confd artifactory elog "Artifact storage is /var/lib/artifact. Ensure that there is enough space." elog "The default password for user 'admin' is 'password'." elog "After upgrading clean up the jetty-dir '${ARTIFACTORY_INSTALL}/work'" }