Import acme-utils and tomcat-bin ebuilds

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich
2021-02-16 13:44:16 +01:00
parent d66a55eeb7
commit 334b29843d
9 changed files with 823 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
AUX 8.5/tomcat-instance-manager-r1.bash 6451 BLAKE2B 3bcd9dd4d3360a91f4a548c050eab6f7174453cfbe7b4a1a7167e122efa3ec2ea6c17c88de1f9223e21e773cf717ed04d79fe0b1e7fc816400033094a07a35c6 SHA512 3c8f994519d1ca5ff24229798786ad3d75dd20dbf8b3b81f6c0ccd121b978d2cb12633270f463a39ed5c4097e5869b1a4bfbf867994a64c5e41916e378038570
AUX 8.5/tomcat.conf 1544 BLAKE2B c606b51514dfa24fdfe941bf5a35625b779cc7b81780d5af5810dc208e49139edaa13cd5476adce9ae8de6a455de559e2b3e1f11dcc1bfe54e0132dd15b571be SHA512 36ba5c4ccf9ac062acfaaecefd9aba1065fd5553df21cd9c2ffd2b320de472c3397d8499d3a2a96b51d8ef513aa86d5879a42287579da4152916802a988c7811
AUX 8.5/tomcat.init 2989 BLAKE2B cf9e967d71581968ceb08c7d9c1ad440fab173f9037e8580cc4604a159e4ae9f948bc0dbc04c81fd819d27887a10e2acca957db0150162ac794d7b44d1bcbace SHA512 f64983a87fcc65fde231e66554a22616330bae78a093118ece9bed47ed64e776ae6aafb77cf6c0da29a3e6b187bc6184d1314f67a69d7176da3474ba7e45c0e3
AUX 8.5/tomcat.systemd 3918 BLAKE2B 8b4eaaae1a7bb913ee8bac1b504eb053e6ff8cb524b7f45d68edfc949dbf05207cc5d7c86c7920cb3e96eb69ff744a5b36de59adb64369f1063238bbd4b93d42 SHA512 b30a85e4a57737ae471de647d2e748d2672364fc6441b90ab1e0338130349c93458b6a881cfd4472d839c0ec6356885d00fe5ea7d7de916b69a912c41121805a
DIST apache-tomcat-8.5.63.tar.gz 10515248 BLAKE2B 0e290e8589312fd8394be846066f29f2fb793e2d844644a2f0bd40f309ebf4bfadce226984e6b99b2b3f9fc1f8c18d2afffb93f967ab275b7ede6c31b2594da9 SHA512 f6379373fa688a6a6a49b47589fe02b753dbb639cd85e5deeb9481651343172fbbcc2944e0d3975cce471ca0dcf8f906b7bdab908253d685f588dcafe99de880
EBUILD tomcat-bin-8.5.63.ebuild 4040 BLAKE2B d5af9d6c8c925f47318a925ec4668764ea0e5370c5d07cd0882ffae6064bfc2118f24b837f834b149d2fdd51b7aa20b23d6dd247180f302ddcc15f2100b8de9d SHA512 d07a9a87e7ee5b87f83fab625b40d79b0f9267aea90e3617f0b73ef0455949e04d5d469f443709c2b272f8b27e35f647b4e976850f895c986f27ef3bc449e852

View File

@@ -0,0 +1,240 @@
#!/bin/bash
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Author: Ralph Sennhauser <sera@gentoo.org>
die() {
echo "${@}"
exit 1
}
usage() {
cat <<EOL
Usage: ${BASH_SOURCE} <--create|--remove|--help> [--suffix s][--user u][--group g]
Options:
--help:
show this text.
--create:
create a new instance
--remove:
remove an existing instance.
--suffix SUFFIX:
a suffix for this instance. the suffix may not collide with an already
existing instance, defaults to empty.
--user USER:
the user for which to configure this instance for. The user needs to
exist already. defaults to tomcat.
--group GROUP:
the group for which to configure this instance for. The group needs to
exist already. defaults to tomcat.
Examples:
${BASH_SOURCE} --create --suffix testing --user tacmot --group tacmot
${BASH_SOURCE} --remove --suffix testing
EOL
}
parse_argv() {
action="not specified"
instance_name="tomcat-@SLOT@"
instance_user="tomcat"
instance_group="tomcat"
while [[ -n $1 ]]; do
case $1 in
--help)
usage
exit 0;;
--suffix)
instance_name+="-$2"
shift; shift;;
--user)
instance_user="$2"
shift; shift;;
--group)
instance_group="$2"
shift; shift;;
--create)
action=create
shift;;
--remove)
action=remove
shift;;
--backup)
action=backup
shift;;
--restore)
action=restore
shift;;
--update)
action=update
shift;;
*)
echo "Invalid option '$1'"
usage
exit 2;;
esac
done
tomcat_home="/@GENTOO_PORTAGE_EPREFIX@usr/share/tomcat-@SLOT@"
instance_base="/@GENTOO_PORTAGE_EPREFIX@var/lib/${instance_name}"
instance_conf="/@GENTOO_PORTAGE_EPREFIX@etc/${instance_name}"
instance_logs="/@GENTOO_PORTAGE_EPREFIX@var/log/${instance_name}"
instance_temp="/@GENTOO_PORTAGE_EPREFIX@var/tmp/${instance_name}"
all_targets=(
"${instance_base}"
"${instance_logs}"
"${instance_temp}"
"/@GENTOO_PORTAGE_EPREFIX@etc/${instance_name}"
"/@GENTOO_PORTAGE_EPREFIX@etc/init.d/${instance_name}"
"/@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${instance_name}"
)
}
test_can_deploy() {
local no_deploy target
for target in "${all_targets[@]}"; do
if [[ -e "${target}" ]]; then
echo "Error: '${target}' already exists."
no_deploy=yes
fi
done
if [[ -n "${no_deploy}" ]]; then
cat <<-EOL
To protect an existing installation no new instance was deployed. You can use
'${BASH_SOURCE} --remove'
to remove an existing instance first or run
'${BASH_SOURCE} --create --sufix <instance_suffix>'
to deploy an instance under a different name
EOL
usage
exit 1
fi
if ! getent passwd | cut -d: -f1 | grep -Fx "${instance_user}" > /dev/null; then
echo "Error: user '${instance_user}' doesn't exist."
exit 1
fi
if ! getent group | cut -d: -f1 | grep -Fx "${instance_group}" > /dev/null; then
echo "Error: group '${instance_group}' doesn't exist."
exit 1
fi
}
deploy_instance() {
test_can_deploy
mkdir -p "${instance_base}"/{work,webapps} || die
mkdir -p "${instance_logs}" || die
mkdir -p "${instance_temp}" || die
cp -r "${tomcat_home}"/webapps/ROOT "${instance_base}"/webapps || die
chown -R "${instance_user}":"${instance_group}" \
"${instance_base}" "${instance_logs}" "${instance_temp}" || die
find "${instance_base}"/webapps -type d -exec chmod 750 {} + || die
find "${instance_base}"/webapps -type f -exec chmod 640 {} + || die
# initial config #
cp -r "${tomcat_home}"/conf "${instance_conf}" || die
sed -i -e "s|\${catalina.base}/logs|${instance_logs}|" \
"${instance_conf}"/logging.properties || die
sed -i -e "s|directory=\"logs\"|directory=\"${instance_logs}\"|" \
"${instance_conf}"/server.xml || die
mkdir -p "${instance_conf}"/Catalina/localhost || die
cat > "${instance_conf}"/Catalina/localhost/host-manager.xml <<-'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.home}/webapps/host-manager"
antiResourceLocking="false" privileged="true" />
EOF
cat > "${instance_conf}"/Catalina/localhost/manager.xml <<-'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.home}/webapps/manager"
antiResourceLocking="false" privileged="true" />
EOF
if [[ -d "${tomcat_home}"/webapps/docs ]]; then
cat > "${instance_conf}"/Catalina/localhost/docs.xml <<-'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.home}/webapps/docs" />
EOF
fi
if [[ -d "${tomcat_home}"/webapps/examples ]]; then
cat > "${instance_conf}"/Catalina/localhost/examples.xml <<-'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.home}/webapps/examples" />
EOF
fi
chown -R "${instance_user}":"${instance_group}" "${instance_conf}" || die
find "${instance_conf}" -type d -exec chmod 750 {} + || die
find "${instance_conf}" -type f -exec chmod 640 {} + || die
# rc script #
cp "${tomcat_home}"/gentoo/tomcat.init \
"/@GENTOO_PORTAGE_EPREFIX@etc/init.d/${instance_name}" || die
sed -e "s|@INSTANCE_NAME@|${instance_name}|g" \
-e "s|@INSTANCE_USER@|${instance_user}|g" \
-e "s|@INSTANCE_GROUP@|${instance_group}|g" \
"${tomcat_home}"/gentoo/tomcat.conf \
> "/@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${instance_name}" || die
# some symlinks for tomcat and netbeans #
ln -s "${instance_conf}" "${instance_base}"/conf || die
ln -s "${instance_temp}" "${instance_base}"/temp || die
# a note to update the default configuration #
cat <<-EOL
Successfully created instance '${instance_name}'
It's strongly recommended for production systems to go carefully through the
configuration files at '${instance_conf}'.
The generated initial configuration is close to upstreams default which
favours the demo aspect over hardening.
EOL
}
remove_instance() {
echo "The following files will be removed permanently:"
local target; for target in "${all_targets[@]}"; do
find ${target}
done
echo "Type 'yes' to continue"
read
if [[ ${REPLY} == yes ]]; then
rm -rv "${all_targets[@]}"
else
echo "Aborting as requested ..."
fi
}
parse_argv "$@"
if [[ ${action} == create ]]; then
deploy_instance
elif [[ ${action} == remove ]]; then
remove_instance
elif [[ ${action} == "not specified" ]]; then
echo "No action specified!"
usage
exit 1
else
echo "${action} not yet implemented!"
usage
exit 1
fi

View File

@@ -0,0 +1,49 @@
# Set the handle of the JVM to use. If unset uses the system-vm.
# run 'eselect java-vm list' to get possible values.
#
#TOMCAT_JVM="icedtea-7"
# Additional options to pass to the JVM.
# Example to set library path for tomcat-native:
# JAVA_OPTS="-Djava.library.path=/usr/lib"
#
#JAVA_OPTS=""
# Additional packages to put on the default classpath.
# jakarta-jstl is needed for some of the examples.
# Note: The extra jars listed here will be visible to webapps.
# Example:
# TOMCAT_EXTRA_JARS="jakarta-jstl,xerces-2"
#
#TOMCAT_EXTRA_JARS=""
# User/Group of this instance.
CATALINA_USER=@INSTANCE_USER@
CATALINA_GROUP=@INSTANCE_GROUP@
# Directory path location of temporary directory the JVM should
# use (java.io.tmpdir).
# Note: This directory must exist and be read/writable by tomcat.
# See #246362 as an example where /var/tmp was deleted on shutdown.
#
#CATALINA_TMPDIR="/@GENTOO_PORTAGE_EPREFIX@var/tmp/@INSTANCE_NAME@"
# TOMCAT STARTUP
# debug Start Catalina in a debugger
# -security debug Debug Catalina with a security manager
# jpda start Start Catalina under JPDA debugger
# start Start Catalina in a separate window
# -security start Start in a separate window with security manager
#
#TOMCAT_START="start"
# Java Platform Debugger Architecture (JPDA)
# http://java.sun.com/products/jpda/
# Override default JPDA address and transport for the "jpda start" command.
#
#JPDA_ADDRESS="8000"
#JPDA_TRANSPORT="dt_socket"
# Additional options to pass to catalina
#
#CATALINA_OPTS=""

View File

@@ -0,0 +1,105 @@
#!/@GENTOO_PORTAGE_EPREFIX@sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
extra_commands="forcestop"
PIDFILE=/@GENTOO_PORTAGE_EPREFIX@var/run/${RC_SVCNAME}.pid
: ${CATALINA_HOME:=/@GENTOO_PORTAGE_EPREFIX@opt/tomcat@SLOT@}
: ${CATALINA_BASE:=/@GENTOO_PORTAGE_EPREFIX@var/lib/${RC_SVCNAME}}
: ${CATALINA_TMPDIR:=/@GENTOO_PORTAGE_EPREFIX@var/tmp/${RC_SVCNAME}}
: ${CATALINA_USER:=tomcat}
: ${CATALINA_GROUP:=tomcat}
: ${TOMCAT_START:=start}
: ${JPDA_TRANSPORT:="dt_socket"}
: ${JPDA_ADDRESS:="8000"}
: ${JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT},address=${JPDA_ADDRESS},server=y,suspend=n"}
export JAVA_HOME=`java-config ${TOMCAT_JVM:+--select-vm ${TOMCAT_JVM}} --jre-home`
CLASSPATH=`java-config --classpath tomcat-bin-@SLOT@${TOMCAT_EXTRA_JARS:+,${TOMCAT_EXTRA_JARS}}`
export CLASSPATH="${CLASSPATH}${TOMCAT_EXTRA_CLASSPATH:+:${TOMCAT_EXTRA_CLASSPATH}}"
depend() {
use dns logger net
}
start() {
ebegin "Starting '${RC_SVCNAME}'"
if [ ! -e "${CATALINA_TMPDIR}" ]; then
eerror "CATALINA_TMPDIR does not exist. Unable to start tomcat."
eerror "Please see /@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${RC_SVCNAME} for more information."
eend 1
fi
cmd=java args=
if [ "${TOMCAT_START}" = "debug" ] || [ "${TOMCAT_START}" = "-security debug" ] ; then
cmd=jdb
args="${args} -sourcepath ${CATALINA_HOME}/../../jakarta-tomcat-catalina/catalina/src/share"
fi
if [ "${TOMCAT_START}" = "-security debug" ] || [ "${TOMCAT_START}" = "-security start" ]; then
args="${args} -Djava.security.manager"
args="${args} -Djava.security.policy=${CATALINA_BASE}/conf/catalina.policy"
fi
if [ "${TOMCAT_START}" = "jpda start" ] ; then
args="${args} ${JPDA_OPTS}"
fi
if [ -r "${CATALINA_HOME}"/bin/tomcat-juli.jar ]; then
args="${args} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties"
fi
start-stop-daemon --start \
--quiet --background \
--chdir "${CATALINA_TMPDIR}" \
--user ${CATALINA_USER}:${CATALINA_GROUP} \
--make-pidfile --pidfile ${PIDFILE} \
--exec ${JAVA_HOME}/bin/${cmd} \
-- \
${JAVA_OPTS} \
${args} \
-Dcatalina.base="${CATALINA_BASE}" \
-Dcatalina.home="${CATALINA_HOME}" \
-Djava.io.tmpdir="${CATALINA_TMPDIR}" \
-classpath "${CLASSPATH}" \
org.apache.catalina.startup.Bootstrap \
${CATALINA_OPTS} \
${TOMCAT_START}
eend $?
}
stop() {
ebegin "Stopping '${RC_SVCNAME}'"
start-stop-daemon --stop \
--quiet --retry=60 \
--pidfile ${PIDFILE} \
--exec ${JAVA_HOME}/bin/java \
-- \
${JAVA_OPTS} \
-classpath "${CLASSPATH}" \
${CATALINA_OPTS} \
stop ${STD_OUT}
eend $?
}
forcestop() {
ebegin "Forcing '${RC_SVCNAME}' to stop"
start-stop-daemon --stop \
--quiet --retry=60 \
--pidfile ${PIDFILE} \
--signal=9
if service_started "${RC_SVCNAME}"; then
mark_service_stopped "${RC_SVCNAME}"
fi
eend $?
}

View File

@@ -0,0 +1,145 @@
#!/bin/bash
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
eerror() {
echo "ERROR: ${@}" >&2
}
RC_SVCNAME="${2:-tomcat@SLOT@}"
RC_SVCBASE="/@GENTOO_PORTAGE_EPREFIX@etc/conf.d/"
RC_SVCCONF="${RC_SVCBASE}${RC_SVCNAME}"
if [ ! -e "${RC_SVCCONF}" ]; then
# Try alternate (preferred) service name "tomcat@SLOT@-NAME" before giving up
RC_SVCNAME="tomcat@SLOT@-${RC_SVCNAME/tomcat@SLOT@-/}"
RC_SVCCONF="${RC_SVCBASE}${RC_SVCNAME}"
if [ ! -e "${RC_SVCCONF}" ]; then
eerror "Invalid instance name \"${RC_SVCNAME}\""
eerror "Make sure the instance name is correct and the configuration file"
eerror "in \"${RC_SVCCONF}\" exists and is readable by the tomcat user"
exit 1
fi
fi
source ${RC_SVCCONF}
if [ $? -ne 0 ]; then
eerror "Environment configuration file \"${RC_SVCCONF}\" contains errors"
exit 1
fi
: ${CATALINA_HOME:=/@GENTOO_PORTAGE_EPREFIX@opt/tomcat@SLOT@}
: ${CATALINA_BASE:=/@GENTOO_PORTAGE_EPREFIX@var/lib/${RC_SVCNAME}}
: ${CATALINA_TMPDIR:=/@GENTOO_PORTAGE_EPREFIX@var/tmp/${RC_SVCNAME}}
: ${TOMCAT_START:=start}
: ${JPDA_TRANSPORT:="dt_socket"}
: ${JPDA_ADDRESS:="8000"}
: ${JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT},address=${JPDA_ADDRESS},server=y,suspend=n"}
JAVA_HOME=`java-config ${TOMCAT_JVM:+--select-vm ${TOMCAT_JVM}} --jre-home`
CLASSPATH=`java-config --classpath tomcat-bin-@SLOT@${TOMCAT_EXTRA_JARS:+,${TOMCAT_EXTRA_JARS}}`
CLASSPATH="${CLASSPATH}${TOMCAT_EXTRA_CLASSPATH:+:${TOMCAT_EXTRA_CLASSPATH}}"
start() {
if [ ! -e "${CATALINA_BASE}" ]; then
eerror "CATALINA_BASE does not exist. Unable to start tomcat."
exit 1
fi
if [ ! -e "${CATALINA_HOME}" ]; then
eerror "CATALINA_HOME does not exist. Unable to start tomcat."
exit 1
fi
if [ ! -e "${CATALINA_TMPDIR}" ]; then
eerror "CATALINA_TMPDIR does not exist. Unable to start tomcat."
eerror "Please see /@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${RC_SVCNAME} for more information."
exit 1
fi
if [ $(id -u) -eq 0 ]; then
eerror "This service should not be started as root"
exit 1
fi
cmd=java args=
if [ "${TOMCAT_START}" = "debug" ] || [ "${TOMCAT_START}" = "-security debug" ] ; then
cmd=jdb
args="${args} -sourcepath ${CATALINA_HOME}/../../jakarta-tomcat-catalina/catalina/src/share"
fi
if [ "${TOMCAT_START}" = "-security debug" ] || [ "${TOMCAT_START}" = "-security start" ]; then
args="${args} -Djava.security.manager"
args="${args} -Djava.security.policy=${CATALINA_BASE}/conf/catalina.policy"
fi
if [ "${TOMCAT_START}" = "jpda start" ] ; then
args="${args} ${JPDA_OPTS}"
fi
if [ -r "${CATALINA_HOME}"/bin/tomcat-juli.jar ]; then
args="${args} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties"
fi
cd "${CATALINA_BASE}"
exec ${JAVA_HOME}/bin/${cmd} \
${JAVA_OPTS} \
${args} \
-Dcatalina.base="${CATALINA_BASE}" \
-Dcatalina.home="${CATALINA_HOME}" \
-Djava.io.tmpdir="${CATALINA_TMPDIR}" \
-classpath "${CLASSPATH}" \
org.apache.catalina.startup.Bootstrap \
${CATALINA_OPTS} \
${TOMCAT_START}
}
stop() {
exec ${JAVA_HOME}/bin/java \
${JAVA_OPTS} \
-Dcatalina.base="${CATALINA_BASE}" \
-Dcatalina.home="${CATALINA_HOME}" \
-Djava.io.tmpdir="${CATALINA_TMPDIR}" \
-classpath "${CLASSPATH}" \
org.apache.catalina.startup.Bootstrap \
${CATALINA_OPTS} \
stop
ret=$?
# Ignore sigterm
[[ $ret -eq 143 ]] && \
ret=0
return $ret
}
version() {
exec ${JAVA_HOME}/bin/java \
${JAVA_OPTS} \
-Dcatalina.base="${CATALINA_BASE}" \
-Dcatalina.home="${CATALINA_HOME}" \
-Djava.io.tmpdir="${CATALINA_TMPDIR}" \
-classpath "${CLASSPATH}" \
org.apache.catalina.util.ServerInfo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
version)
version
;;
*)
echo "Usage: $0 {start|stop|restart|version|getenv} [instance name]" >&2
exit 1
esac

View File

@@ -0,0 +1,140 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
IUSE="doc extra-webapps"
inherit eutils java-pkg-2 prefix user
MY_P="apache-${P/-bin}"
MY_PN="${PN/-bin}"
SLOT="${PV%.*}"
DESCRIPTION="Tomcat Servlet-3.1/JSP-2.3 Container"
HOMEPAGE="http://tomcat.apache.org/"
SRC_URI="mirror://apache/tomcat/tomcat-${PV%%.*}/v${PV}/bin/${MY_P}.tar.gz"
LICENSE="Apache-2.0"
KEYWORDS="amd64 x86"
RDEPEND=">=virtual/jre-1.7"
DEPEND="!!www-servers/tomcat
sys-apps/sed
${RDEPEND}"
TOMCAT_NAME="${MY_PN}${SLOT}"
TOMCAT_HOME="/opt/${TOMCAT_NAME}"
TOMCAT_BASE="/var/lib//${TOMCAT_NAME}"
S="${WORKDIR}/${MY_P}"
# revision of the instance-manager script
IM_REV="-r1"
pkg_setup() {
java-pkg-2_pkg_setup
enewgroup tomcat 265
enewuser tomcat 265 -1 /dev/null tomcat
}
java_prepare() {
# For use of catalina.sh in netbeans
sed -i -e "/^# ----- Execute The Requested Command/ a\
CLASSPATH=\`java-config --classpath ${PN}-${SLOT}\`" \
bin/catalina.sh || die
}
src_install() {
java-pkg_jarinto "${TOMCAT_HOME}/bin"
java-pkg_dojar bin/*.jar
exeinto "${TOMCAT_HOME}/bin"
doexe bin/*.sh
java-pkg_jarinto "${TOMCAT_HOME}/lib"
java-pkg_dojar lib/*.jar
dodoc RELEASE-NOTES RUNNING.txt
use doc && java-pkg_dojavadoc dist/webapps/docs/api
### Webapps ###
insinto "${TOMCAT_HOME}"/webapps
doins -r webapps/{host-manager,manager,ROOT}
use extra-webapps && doins -r webapps/{docs,examples}
### Config ###
# replace the default pw with a random one, see #92281
local randpw=$(echo ${RANDOM}|md5sum|cut -c 1-15)
sed -i -e "s|SHUTDOWN|${randpw}|" conf/server.xml || die
insinto "/etc/${TOMCAT_NAME}"
doins -r conf/*
dodoc -r conf
fperms 640 "/etc/${TOMCAT_NAME}/"{tomcat-users.xml,server.xml}
### rc ###
cp "${FILESDIR}"/${SLOT}/tomcat{.conf,.init,.systemd,-instance-manager${IM_REV}.bash} "${T}" || die
eprefixify "${T}"/tomcat{.conf,.init,.systemd,-instance-manager${IM_REV}.bash}
sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,.init,.systemd,-instance-manager${IM_REV}.bash} || die
# Unsupported for now
# insinto "${TOMCAT_HOME}/gentoo"
# doins "${T}"/tomcat.conf
# exeinto "${TOMCAT_HOME}/gentoo"
# doexe "${T}"/tomcat.init
# newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash
# create default instance
sed -i \
-e "s|@INSTANCE_USER@|tomcat|g" \
-e "s|@INSTANCE_GROUP@|tomcat|g" \
-e "s|@INSTANCE_GROUP@|tomcat|g" \
-e "s|@INSTANCE_NAME@|tomcat${SLOT}|g" \
"${T}"/tomcat.{conf,init,systemd} || die
newinitd "${T}"/tomcat.init "tomcat${SLOT}"
newconfd "${T}"/tomcat.conf "tomcat${SLOT}"
newexe "${T}"/tomcat.systemd "tomcat${SLOT}-systemd"
dosym "${TOMCAT_HOME}/webapps" "${TOMCAT_BASE}/webapps"
keepdir "${TOMCAT_BASE}/"{bin,work} "/var/tmp/${TOMCAT_NAME}" "/var/log/${TOMCAT_NAME}"
dosym "/var/tmp/${TOMCAT_NAME}" "${TOMCAT_BASE}/temp"
dosym "/var/log/${TOMCAT_NAME}" "${TOMCAT_BASE}/logs"
dosym "/etc/${TOMCAT_NAME}" "${TOMCAT_BASE}/conf"
}
pkg_preinst() {
fperms 750 "${TOMCAT_BASE}"
fowners -R root:tomcat "${TOMCAT_BASE}"
fowners -R tomcat:tomcat "${TOMCAT_BASE}/work"
fperms 750 "${TOMCAT_HOME}"
fowners -R root:tomcat "${TOMCAT_HOME}"
fperms 750 "/etc/${TOMCAT_NAME}"
fowners -R root:tomcat "/etc/${TOMCAT_NAME}"
fperms 750 "/var/tmp/${TOMCAT_NAME}"
fowners -R tomcat:tomcat "/var/tmp/${TOMCAT_NAME}"
fperms 750 "/var/log/${TOMCAT_NAME}"
fowners -R tomcat:tomcat "/var/log/${TOMCAT_NAME}"
}
pkg_postinst() {
elog "New ebuilds of Tomcat support running multiple instances. If you used prior version"
elog "of Tomcat (<7.0.32), you have to migrate your existing instance to work with new Tomcat."
elog "You can find more information at https://wiki.gentoo.org/wiki/Apache_Tomcat"
elog "To manage Tomcat instances, run:"
elog " ${EPREFIX}/${TOMCAT_HOME}/gentoo/tomcat-instance-manager.bash --help"
ewarn "tomcat-dbcp.jar is not built at this time. Please fetch jar"
ewarn "from upstream binary if you need it. Gentoo Bug # 144276"
}