better ebuild
This commit is contained in:
parent
b0b2e3d8a8
commit
84293449c3
@ -1,59 +1,90 @@
|
|||||||
# Copyright 1999-2011 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: $
|
|
||||||
|
|
||||||
EAPI=3
|
EAPI=2
|
||||||
|
|
||||||
JAVA_PKG_IUSE="doc source"
|
inherit eutils
|
||||||
|
|
||||||
inherit java-pkg-2 java-ant-2 eutils
|
|
||||||
|
|
||||||
DESCRIPTION="Artifactory Maven Artifact Server"
|
DESCRIPTION="Artifactory Maven Artifact Server"
|
||||||
HOMEPAGE="http://www.jfrog.org/products.php"
|
HOMEPAGE="http://www.jfrog.org/products.php"
|
||||||
SRC_URI="mirror://sourceforge/artifactory/${P}.zip"
|
|
||||||
|
SLOT="0"
|
||||||
|
SRC_URI="mirror://sourceforge/${PN}/${P}.zip"
|
||||||
|
KEYWORDS="~amd64 ~x86"
|
||||||
|
|
||||||
LICENSE="LGPL-3"
|
LICENSE="LGPL-3"
|
||||||
SLOT="0"
|
IUSE="mysql derby postgres"
|
||||||
KEYWORDS="~amd64"
|
|
||||||
|
|
||||||
IUSE=""
|
RDEPEND=">=virtual/jre-1.5"
|
||||||
|
DEPEND=">=virtual/jdk-1.5"
|
||||||
|
|
||||||
COMMON_DEP=""
|
ARTIFACTORY_HOME=/var/lib/${PN}
|
||||||
|
ARTIFACTORY_INSTALL=/usr/share/${PN}
|
||||||
RDEPEND=">=virtual/jre-1.5
|
ARTIFACTORY_USER=artifact
|
||||||
${COMMON_DEP}"
|
|
||||||
DEPEND=">=virtual/jdk-1.5
|
|
||||||
app-arch/unzip
|
|
||||||
${COMMON_DEP}"
|
|
||||||
|
|
||||||
EANT_BUILD_TARGET=""
|
|
||||||
EANT_DOC_TARGET=""
|
|
||||||
|
|
||||||
INSTALL_DIR="/opt/artifactory"
|
|
||||||
WEBAPP_DIR="${INSTALL_DIR}/webapp"
|
|
||||||
IDIR=${D}$INSTALL_DIR
|
|
||||||
|
|
||||||
pkg_setup() {
|
pkg_setup() {
|
||||||
#enewgroup <name> [gid]
|
|
||||||
enewgroup artifact
|
enewgroup artifact
|
||||||
#enewuser <user> [uid] [shell] [homedir] [groups] [params]
|
enewuser ${ARTIFACTORY_USER} -1 /bin/sh -1 artifact
|
||||||
enewuser artifact -1 /bin/bash /opt/artifactory artifact
|
|
||||||
}
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
unpack ${A}
|
|
||||||
cd "${S}"
|
|
||||||
|
|
||||||
# epatch "${FILESDIR}/${P}.patch"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
use doc && java-pkg_dojavadoc build/javadoc
|
cd "${S}/bin"
|
||||||
use source && java-pkg_dosrc src
|
ls | grep -E "\.(bat|exe)" | xargs rm || die "remove failed"
|
||||||
dodir ${INSTALL_DIR}
|
|
||||||
cp -r ${PN}.jar bin clilib lib misc webapps ${D}/${INSTALL_DIR}
|
|
||||||
insinto /etc/${PN}
|
|
||||||
doins etc/*
|
|
||||||
newinitd ${FILESDIR}/artifactory.initd ${PN}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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/oracle10
|
||||||
|
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
|
||||||
|
|
||||||
|
# remove windows-wrapper
|
||||||
|
rm ${S}/lib/wrapper*
|
||||||
|
|
||||||
|
sed -i -e "s:<SystemProperty name=\"artifactory.home\" default=\"..\"/>/webapps:${ARTIFACTORY_INSTALL}/webapps:" "${S}"/etc/jetty.xml
|
||||||
|
sed -i -e "s:<SystemProperty name=\"artifactory.home\" default=\"..\"/>/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
|
||||||
|
# doexe bin/artifactory.sh
|
||||||
|
|
||||||
|
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'."
|
||||||
|
}
|
||||||
|
16
dev-java/artifactory/files/artifactory.confd
Normal file
16
dev-java/artifactory/files/artifactory.confd
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
# Port for jetty
|
||||||
|
ARTIFACTORY_PORT="8081"
|
||||||
|
|
||||||
|
# Home dir of artifactory
|
||||||
|
ARTIFACTORY_HOME="/var/lib/artifactory"
|
||||||
|
ARTIFACTORY_INSTALL="/usr/share/artifactory"
|
||||||
|
|
||||||
|
# Options for artifacory
|
||||||
|
ARTIFACTORY_OPTS=""
|
||||||
|
|
||||||
|
# User and group as which to run artifactory
|
||||||
|
#ARTIFACTORY_USER="artifact"
|
||||||
|
#ARTIFACTORY_GROUP="artifact"
|
||||||
|
|
||||||
|
JAVA_OPTIONS="-server -Xms1g -Xmx1g -Xss256k -XX:PermSize=128m -XX:MaxPermSize=128m -XX:NewSize=384m -XX:MaxNewSize=384m -Djava.awt.headless=true"
|
@ -1,37 +1,33 @@
|
|||||||
#!/sbin/runscript
|
#!/sbin/runscript
|
||||||
# Installed in /etc/init.d/artifactory
|
# Copyright 1999-2011 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License, v2 or later
|
||||||
export JAVA_HOME=/etc/java-config-2/current-system-vm
|
# $Header: $
|
||||||
export PATH=$JAVA_HOME/bin:$PATH
|
|
||||||
DESC="Artifactory Maven Artifact Server"
|
|
||||||
NAME=artifactory
|
|
||||||
PIDFILE=/var/run/$NAME.pid
|
|
||||||
RUN_AS=artifact
|
|
||||||
ARTIFACTORY_HOME=/opt/artifact/artifactory
|
|
||||||
COMMAND=$ARTIFACTORY_HOME/bin/artifactory.init
|
|
||||||
ARGS="$ARTIFACTORY_HOME/etc/jetty.xml"
|
|
||||||
LOGFILE="$ARTIFACTORY_HOME/logs/consoleout.log"
|
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
use net
|
need net
|
||||||
after logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
ebegin "Starting $DESC"
|
ebegin "Starting artifactory"
|
||||||
start-stop-daemon --start --verbose --background --make-pidfile --pidfile $PIDFILE\
|
JAVACMD=$(java-config-2 -J)
|
||||||
--chdir $ARTIFACTORY_HOME --chuid $RUN_AS --exec $COMMAND -- $ARGS > $LOGFILE 2>&1
|
JAVA_OPTIONS="$JAVA_OPTIONS -server -Djetty.home=$ARTIFACTORY_HOME -Dartifactory.home=$ARTIFACTORY_HOME -Dfile.encoding=UTF8"
|
||||||
|
LIB_DIR=$ARTIFACTORY_INSTALL/lib
|
||||||
|
CLASSPATH=$ARTIFACTORY_INSTALL/artifactory.jar
|
||||||
|
# Add all jars under the lib dir to the classpath
|
||||||
|
for i in $(ls $LIB_DIR/*.jar)
|
||||||
|
do
|
||||||
|
CLASSPATH="$CLASSPATH:$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
start-stop-daemon --start --chuid ${ARTIFACTORY_USER:-artifact}:${ARTIFACTORY_GROUP:-artifact} \
|
||||||
|
-t --chdir "/var/lib/artifactory" \
|
||||||
|
--pidfile /var/run/artifactory.pid --make-pidfile --background \
|
||||||
|
--exec "$JAVACMD" -- $JAVA_OPTIONS -cp "$CLASSPATH" org.artifactory.standalone.main.Main
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
ebegin "Stopping $DESC"
|
ebegin "Stopping artifactory"
|
||||||
start-stop-daemon --stop --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --quiet --pidfile /var/run/artifactory.pid
|
||||||
|
|
||||||
if [ -e $PIDFILE ]
|
|
||||||
then
|
|
||||||
rm $PIDFILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user