--- tomcat/files/tomcat.init 1970-01-01 01:00:00.000000000 +0100 +++ tomcat/files/tomcat.init 2015-08-09 22:34:55.000000000 +0200 @@ -0,0 +1,105 @@ +#!/@GENTOO_PORTAGE_EPREFIX@sbin/runscript +# 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@usr/share/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-@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 $? +} --- tomcat/files/tomcat-instance-manager-r3.bash 1970-01-01 01:00:00.000000000 +0100 +++ tomcat/files/tomcat-instance-manager-r3.bash 2016-03-10 18:52:12.000000000 +0100 @@ -0,0 +1,297 @@ +#!/bin/bash +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Author: Ralph Sennhauser + +die() { + echo "${@}" + exit 1 +} + +dir_is_empty() { + # usage: + # dir_is_empty + # + # returns 2 if the dir does not even exist + # returns 1 if the dir is not empty + # returns 0 (success) if the dir exists and is empty + + local dir=$1 + local files + + if [[ ! -e ${dir} ]] ; then + return 2 + fi + + shopt -s nullglob dotglob # To include hidden files + files=( "${dir}"/* ) + shopt -u nullglob dotglob + + if [[ ${#files[@]} -eq 0 ]]; then + return 0 + else + return 1 + fi + +} + +usage() { + cat < [--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_systemd=${instance_name} + instance_user="tomcat" + instance_group="tomcat" + + while [[ -n $1 ]]; do + case $1 in + --help) + usage + exit 0;; + --suffix) + instance_name+="-$2" + instance_systemd+="@${2}.service.d" + 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}" + + if [[ -x /usr/bin/systemctl ]] && ([[ "${instance_user}" != "tomcat" ]] || [[ "${instance_group}" != "tomcat" ]]); then + systemd_overlay="/@GENTOO_PORTAGE_EPREFIX@etc/systemd/system/${instance_systemd}" + fi + + if [[ -d "/@GENTOO_PORTAGE_EPREFIX@etc/systemd/system/${instance_systemd}" ]]; then + 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}" + "/@GENTOO_PORTAGE_EPREFIX@etc/systemd/system/${instance_systemd}" + ) + else + 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}" + ) + fi +} + +test_can_deploy() { + local no_deploy target + for target in "${all_targets[@]}"; do + if [[ -e "${target}" ]]; then + if ! dir_is_empty "${target}" ; then + echo "Error: '${target}' already exists and is not empty." + no_deploy=yes + fi + 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 --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 + if [[ ! -z "${systemd_overlay}" ]]; then + mkdir -p "${systemd_overlay}" || die + cat > "${systemd_overlay}"/00-gentoo.conf <<-'EOF' +[Service] +User=@INSTANCE_USER@ +Group=@INSTANCE_GROUP@ +EOF + sed -i -e "s|@INSTANCE_USER@|${instance_user}|g" \ + -e "s|@INSTANCE_GROUP@|${instance_group}|g" \ + "${systemd_overlay}"/00-gentoo.conf || die + fi + + mkdir -p "${instance_base}"/{work,webapps} || die + mkdir -p "${instance_logs}" || die + mkdir -p "${instance_temp}" || die + mkdir -p "${instance_conf}" || 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' + + +EOF + + cat > "${instance_conf}"/Catalina/localhost/manager.xml <<-'EOF' + + +EOF + + if [[ -d "${tomcat_home}"/webapps/docs ]]; then + cat > "${instance_conf}"/Catalina/localhost/docs.xml <<-'EOF' + + +EOF + fi + + if [[ -d "${tomcat_home}"/webapps/examples ]]; then + cat > "${instance_conf}"/Catalina/localhost/examples.xml <<-'EOF' + + +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 --- tomcat/files/tomcat.start 1970-01-01 01:00:00.000000000 +0100 +++ tomcat/files/tomcat.start 2016-03-10 18:36:05.000000000 +0100 @@ -0,0 +1,132 @@ +#!@GENTOO_PORTAGE_EPREFIX@/bin/bash +# Author: Jens Koegler +# based on the original init.d script +# set debugging on +# set -x +die() { + usage + exit 1 +} + +usage() { + cat < +Usage: NAME= ${BASH_SOURCE} [start|stop] +Instance-name can be the environment variable NAME +EOL +} + +if ([[ $# -gt 2 ]] || [[ $# -eq 0 ]]); then + die +fi + +RUN=$1 +TOMCAT=`basename ${BASH_SOURCE}` +if [ $# -eq 2 ]; then + printf -v INSTANCE "%s-%s" "$TOMCAT" "$2" +else + if [[ -z ${NAME} ]]; then + die + else + printf -v INSTANCE "%s-%s" "$TOMCAT" "$NAME" + fi +fi + +if [[ -f @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${INSTANCE} ]]; then + source @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${INSTANCE} +else + echo "The configuration file in /etc/conf.d does not exist" + die +fi + +: ${CATALINA_HOME:=@GENTOO_PORTAGE_EPREFIX@/usr/share/${TOMCAT}} +: ${CATALINA_BASE:=@GENTOO_PORTAGE_EPREFIX@/var/lib/${INSTANCE}} +: ${CATALINA_TMPDIR:=@GENTOO_PORTAGE_EPREFIX@/var/tmp/${INSTANCE}} + +: ${TOMCAT_START:=start} + +: ${JPDA_TRANSPORT:="dt_socket"} +: ${JPDA_ADDRESS:="8000"} +: ${JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT},address=${JPDA_ADDRESS},server=y,suspend=n"} + +if [ ! -e "${CATALINA_TMPDIR}" ]; then + echo "CATALINA_TMPDIR does not exist. Unable to start tomcat." + echo "Please see /@GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${INSTANCE} for more information." + die +fi + +export JAVA_HOME=`java-config ${TOMCAT_JVM:+--select-vm ${TOMCAT_JVM}} --jre-home` +export CLASSPATH="${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar" + +start() { + + if [ ! -e "${CATALINA_TMPDIR}" ]; then + echo "CATALINA_TMPDIR does not exist. Unable to start tomcat." + echo "Please see /etc/conf.d/${INSTANCE} for more information." + die + fi + + local DEPEND=$(java-config --query DEPEND --package tomcat-@SLOT@):${TOMCAT_EXTRA_JARS} + DEPEND=${DEPEND%:} + + local GCLASSPATH=$(java-config --with-dependencies --classpath "${DEPEND//:/,}"):${TOMCAT_EXTRA_CLASSPATH} + GCLASSPATH=${GCLASSPATH%:} + + local 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 + + ${JAVA_HOME}/bin/${cmd} \ + ${JAVA_OPTS} \ + ${args} \ + '-XX:OnOutOfMemoryError=kill -9 %%p' \ + -Dcatalina.base="${CATALINA_BASE}" \ + -Dcatalina.home="${CATALINA_HOME}" \ + -Djava.io.tmpdir="${CATALINA_TMPDIR}" \ + -Dgentoo.classpath="${GCLASSPATH//:/,}" \ + -classpath "${CLASSPATH}" \ + org.apache.catalina.startup.Bootstrap \ + ${CATALINA_OPTS} \ + ${TOMCAT_START} + +} + +stop() { + + ${JAVA_HOME}/bin/java \ + ${JAVA_OPTS} \ + ${args} \ + -Dcatalina.base="${CATALINA_BASE}" \ + -Dcatalina.home="${CATALINA_HOME}" \ + -Djava.io.tmpdir="${CATALINA_TMPDIR}" \ + -Dgentoo.classpath="${GCLASSPATH//:/,}" \ + -classpath "${CLASSPATH}" \ + org.apache.catalina.startup.Bootstrap stop + +} + +case "${RUN}" in + start) + start + ;; + stop) + stop + ;; + *) + die + ;; +esac + --- tomcat/files/tomcat.systemd 1970-01-01 01:00:00.000000000 +0100 +++ tomcat/files/tomcat.systemd 2015-11-19 19:29:21.000000000 +0100 @@ -0,0 +1,19 @@ +[Unit] +Description=Apache Tomcat Web Application Container +After=network.target + +[Service] +Type=simple +EnvironmentFile=/etc/conf.d/tomcat-@SLOT@-%i +Environment="NAME=%i" +Environment=SHELL=/bin/bash +ExecStart=/usr/bin/tomcat-@SLOT@ start +ExecStop=/usr/bin/tomcat-@SLOT@ stop +SuccessExitStatus=143 +User=tomcat +Group=tomcat +TimeoutStopSec=90 +Restart=always + +[Install] +WantedBy=multi-user.target --- tomcat/tomcat-7.0.67.ebuild 2016-03-17 11:48:43.000000000 +0100 +++ tomcat/tomcat-7.0.67.ebuild 2016-03-31 18:48:29.000000000 +0200 @@ -6,7 +6,7 @@ JAVA_PKG_IUSE="doc source test" -inherit eutils java-pkg-2 java-ant-2 prefix user +inherit eutils java-pkg-2 java-ant-2 prefix user systemd MY_P="apache-${P}-src" @@ -67,7 +67,7 @@ EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false" # revisions of the scripts -IM_REV="-r1" +IM_REV="-r3" INIT_REV="-r1" src_compile() { @@ -120,15 +120,18 @@ ### rc ### - cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} "${T}" || die - eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} - sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} || die + cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} "${T}" || die + eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.start} + sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} || die insinto "${dest}"/gentoo doins "${T}"/tomcat.conf exeinto "${dest}"/gentoo newexe "${T}"/tomcat${INIT_REV}.init tomcat.init newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash + systemd_newunit "${T}"/tomcat.systemd "tomcat-${SLOT}@.service" + exeinto "/usr/bin" + newexe "${T}"/tomcat.start tomcat-${SLOT} } pkg_postinst() { --- tomcat/tomcat-7.0.68-r1.ebuild 2016-03-17 21:36:38.000000000 +0100 +++ tomcat/tomcat-7.0.68-r1.ebuild 2016-03-31 18:50:32.000000000 +0200 @@ -6,7 +6,7 @@ JAVA_PKG_IUSE="doc source test" -inherit eutils java-pkg-2 java-ant-2 prefix user +inherit eutils java-pkg-2 java-ant-2 prefix user systemd MY_P="apache-${P}-src" @@ -66,7 +66,7 @@ EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false" # revisions of the scripts -IM_REV="-r1" +IM_REV="-r3" INIT_REV="-r1" src_compile() { @@ -119,15 +119,18 @@ ### rc ### - cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} "${T}" || die - eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} - sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} || die + cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} "${T}" || die + eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.start} + sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} || die insinto "${dest}"/gentoo doins "${T}"/tomcat.conf exeinto "${dest}"/gentoo newexe "${T}"/tomcat${INIT_REV}.init tomcat.init newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash + systemd_newunit "${T}"/tomcat.systemd "tomcat-${SLOT}@.service" + exeinto "/usr/bin" + newexe "${T}"/tomcat.start tomcat-${SLOT} } pkg_postinst() { --- tomcat/tomcat-8.0.32-r1.ebuild 2016-03-17 21:36:51.000000000 +0100 +++ tomcat/tomcat-8.0.32-r1.ebuild 2016-03-31 18:52:31.000000000 +0200 @@ -6,7 +6,7 @@ JAVA_PKG_IUSE="doc source test" -inherit eutils java-pkg-2 java-ant-2 prefix user +inherit eutils java-pkg-2 java-ant-2 prefix user systemd MY_P="apache-${P}-src" @@ -69,7 +69,7 @@ EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false" # revisions of the scripts -IM_REV="-r2" +IM_REV="-r3" INIT_REV="-r1" src_compile() { @@ -128,15 +128,18 @@ ### rc ### - cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} "${T}" || die - eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} - sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} || die + cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} "${T}" || die + eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.start} + sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} || die insinto "${dest}"/gentoo doins "${T}"/tomcat.conf exeinto "${dest}"/gentoo newexe "${T}"/tomcat${INIT_REV}.init tomcat.init newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash + systemd_newunit "${T}"/tomcat.systemd "tomcat-${SLOT}@.service" + exeinto "/usr/bin" + newexe "${T}"/tomcat.start tomcat-${SLOT} } pkg_postinst() { --- tomcat/tomcat-8.0.33.ebuild 2016-03-26 11:28:47.000000000 +0100 +++ tomcat/tomcat-8.0.33.ebuild 2016-03-31 18:53:14.000000000 +0200 @@ -6,7 +6,7 @@ JAVA_PKG_IUSE="doc source test" -inherit eutils java-pkg-2 java-ant-2 prefix user +inherit eutils java-pkg-2 java-ant-2 prefix user systemd MY_P="apache-${P}-src" @@ -128,15 +128,18 @@ ### rc ### - cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} "${T}" || die - eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} - sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} || die + cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} "${T}" || die + eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.start} + sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} || die insinto "${dest}"/gentoo doins "${T}"/tomcat.conf exeinto "${dest}"/gentoo newexe "${T}"/tomcat${INIT_REV}.init tomcat.init newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash + systemd_newunit "${T}"/tomcat.systemd "tomcat-${SLOT}@.service" + exeinto "/usr/bin" + newexe "${T}"/tomcat.start tomcat-${SLOT} } pkg_postinst() { --- tomcat/tomcat-9.0.0_alpha4.ebuild 2016-03-17 13:45:52.000000000 +0100 +++ tomcat/tomcat-9.0.0_alpha4.ebuild 2016-03-31 18:54:12.000000000 +0200 @@ -6,7 +6,7 @@ JAVA_PKG_IUSE="doc source test" -inherit eutils java-pkg-2 java-ant-2 prefix user +inherit eutils java-pkg-2 java-ant-2 prefix user systemd MY_PV="${PV/_alpha/.M}" MY_P="apache-${PN}-${MY_PV}-src" @@ -70,7 +70,7 @@ EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false" # revisions of the scripts -IM_REV="-r2" +IM_REV="-r3" INIT_REV="-r1" src_compile() { @@ -129,15 +129,18 @@ ### rc ### - cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} "${T}" || die - eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} - sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} || die + cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} "${T}" || die + eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.start} + sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash,.systemd,.start} || die insinto "${dest}"/gentoo doins "${T}"/tomcat.conf exeinto "${dest}"/gentoo newexe "${T}"/tomcat${INIT_REV}.init tomcat.init newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash + systemd_newunit "${T}"/tomcat.systemd "tomcat-${SLOT}@.service" + exeinto "/usr/bin" + newexe "${T}"/tomcat.start tomcat-${SLOT} } pkg_postinst() {