diff options
author | Miroslav Šulc <fordfrog@gentoo.org> | 2019-10-16 10:36:11 +0200 |
---|---|---|
committer | Miroslav Šulc <fordfrog@gentoo.org> | 2019-10-16 10:36:11 +0200 |
commit | baa11b4a987504b74752bbf8f60813064fa84230 (patch) | |
tree | a4e75ed1d8092abee2be6d65050279fd2dee89f5 | |
parent | dev-util/netbeans-standalone-11.2_beta2: bump (diff) | |
download | fordfrog-baa11b4a987504b74752bbf8f60813064fa84230.tar.gz fordfrog-baa11b4a987504b74752bbf8f60813064fa84230.tar.bz2 fordfrog-baa11b4a987504b74752bbf8f60813064fa84230.zip |
www-servers/tomcat-8.0.53: moved from main repo (eol)
Package-Manager: Portage-2.3.77, Repoman-2.3.17
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
-rw-r--r-- | www-servers/tomcat/Manifest | 7 | ||||
-rw-r--r-- | www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch | 270 | ||||
-rw-r--r-- | www-servers/tomcat/files/tomcat-instance-manager-r2.bash | 270 | ||||
-rw-r--r-- | www-servers/tomcat/files/tomcat-r1.init | 110 | ||||
-rw-r--r-- | www-servers/tomcat/files/tomcat.conf | 57 | ||||
-rw-r--r-- | www-servers/tomcat/metadata.xml | 17 | ||||
-rw-r--r-- | www-servers/tomcat/tomcat-8.0.53.ebuild | 159 |
7 files changed, 890 insertions, 0 deletions
diff --git a/www-servers/tomcat/Manifest b/www-servers/tomcat/Manifest new file mode 100644 index 000000000..209888d90 --- /dev/null +++ b/www-servers/tomcat/Manifest @@ -0,0 +1,7 @@ +AUX tomcat-8.0.53-build.xml.patch 10949 BLAKE2B 2693f3e74a69967ceeb5f4ee41756b840da5bc2ab3c64cb855d52bd099bad8d6115f1d01903bacdcb634c24b9085dbb2ef34027f71325f887f20826721b268aa SHA512 20373a340dcb17595e7ff52608e8d3d3b1eddd5f0104b588c5f91b21eb4510047df61a0dfd9ed8674fb7b0b709945d5014d6e1cad4027414ff9e72c2b5d56cfc +AUX tomcat-instance-manager-r2.bash 6996 BLAKE2B 23991da5a19b826d1ab4cb442ec0fe26ade5b55c2d0fb7442f0d299e7680c1218b2fb0512289463f4cd8be692dc3e35f3bec66794a6ef2365e81405dc00b50de SHA512 37e95de6a05b237343d72d8dcb7a2e93d395b446ff7e466d04f3e98e3bcc9fc0b278e151253883d1c7ec1a3343a35c512837ac30a008d58ab07274f19d54bd60 +AUX tomcat-r1.init 3197 BLAKE2B f4492201ea711c989990a5a33a63410e1ffd2720442a60b76a2c3413630c908dda6848ee9772bc52bc6aca78310935fed22a543ee50e0db77221cc12a0158a92 SHA512 50f0db4d098c1baf5381b1512ac80a840e86583320f1ed63e80368b537cea9953d914052c0624a8c093c832861969968efaf8b021f1bd699f1a28a20d3484704 +AUX tomcat.conf 1811 BLAKE2B a92606e113172c6f0f73e18ab8ad8796f38bd8c741bb2fd1f6c43d7682728729d0198d4150e42282c7e732750231b7cdbfb51de9b24f2ba780a22700965113c5 SHA512 0747dd2fdad6c68123425adce39f625d34924ae3e7c9d5a00361565a593047d7a4d01dee64c1ef831e5ad79b51750babaf642b0588d4b5948bbed441d53d654d +DIST apache-tomcat-8.0.53-src.tar.gz 5057041 BLAKE2B 3a50d2f61baecb5244909972384e36478c69e7592dd35119d8b7b974273c57a4855082f309146ed160144dbdcced3236fd586b047970bd8558bbe7b7e002e9fd SHA512 0b56bc723277b2888896ab34ec3e49cb56bac94ddf1a9b96bd023982e2ffabd5317f63b3c0971afdc8cd7a6364197409df461d22151dbaab3a2be7daf6858b9e +EBUILD tomcat-8.0.53.ebuild 4545 BLAKE2B 44a91072cfebcd628579e6859bd6769b5a6c0f6c95d09e7771324bbe3c46ca617ec727338999c7c071c2e5530a3d66d25967f7ae31788ccf7d7d902ca3c0fa97 SHA512 a812d3991b012e5b313b4269710fa15d78fd6b7edcf6b7d7a261fdbe51144389a4583a6eee96b33dbbc4fc0480fc91bf382e6c63f524f2c755ab67e0e82330eb +MISC metadata.xml 633 BLAKE2B 2569991986199138317c46b270fd102782c7f122a7b750c4d30a41a08ca207431546b834e74f32d5c10254b92b7a65f83e11793be779717cfc4eadbddf07e89b SHA512 dfdc75507ee120e3cf385aa07d229ab0df5189a70c7014883ac1546c44129fb42404c045f5e5db6633f60638207e3f16d5ef193b628412da20de5af3c82a53f1 diff --git a/www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch b/www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch new file mode 100644 index 000000000..eb12467b6 --- /dev/null +++ b/www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch @@ -0,0 +1,270 @@ +diff --git a/build.xml b/build.xml +index 5ee1d86..ade4446 100644 +--- a/build.xml ++++ b/build.xml +@@ -723,24 +723,29 @@ + manifest="${tomcat.manifests}/annotations-api.jar.manifest" /> + + <!-- Servlet 3.1 Implementation JAR File --> ++<!-- + <jarIt jarfile="${servlet-api.jar}" + filesDir="${tomcat.classes}" + filesId="files.servlet-api" + manifest="${tomcat.manifests}/servlet-api.jar.manifest" + notice="${tomcat.manifests}/servlet-api.jar.notice" + license="${tomcat.manifests}/servlet-api.jar.license" /> +- ++--> + <!-- JSP 2.3 Implementation JAR File --> ++<!-- + <jarIt jarfile="${jsp-api.jar}" + filesDir="${tomcat.classes}" + filesId="files.jsp-api" + manifest="${tomcat.manifests}/jsp-api.jar.manifest" /> ++--> + + <!-- EL 3.0 Implementation JAR File --> ++<!-- + <jarIt jarfile="${el-api.jar}" + filesDir="${tomcat.classes}" + filesId="files.el-api" + manifest="${tomcat.manifests}/el-api.jar.manifest" /> ++--> + + <!-- WebSocket 1.1 API JAR File --> + <jarIt jarfile="${websocket-api.jar}" +@@ -1010,9 +1015,9 @@ + + <target name="deploy" depends="package,build-docs,build-tomcat-jdbc,compile-webapp-examples" + description="Default. Builds a working Tomcat instance"> +- ++<!-- + <copy tofile="${tomcat.build}/bin/commons-daemon.jar" file="${commons-daemon.jar}" /> +- ++--> + <!-- Copy scripts --> + <copy todir="${tomcat.build}/bin"> + <fileset dir="bin"> +@@ -1072,7 +1077,7 @@ + <exclude name="${jdt.jar.filename}"/> + </fileset> + </delete> +- <copy file="${jdt.jar}" todir="${tomcat.build}/lib"/> ++<!-- <copy file="${jdt.jar}" todir="${tomcat.build}/lib"/> --> + + <!-- Add sources for examples --> + <antcall target="examples-sources" /> +@@ -1108,7 +1113,7 @@ + </javac> + </target> + +- <target name="build-tomcat-jdbc" depends="package"> ++ <target name="build-tomcat-jdbc" depends="package" unless="noget"> + <!-- build the jdbc-pool jar and source jar--> + <echo message="Building Tomcat JDBC pool libraries"/> + <ant antfile="${tomcat.jdbc.dir}/build.xml" dir="${tomcat.jdbc.dir}" +@@ -1123,7 +1128,7 @@ + <copy file="${tomcat-jdbc.jar}" todir="${tomcat.build}/lib"/> + </target> + +- <target name="build-tomcat-jdbc-src"> ++ <target name="build-tomcat-jdbc-src" unless="noget"> + <!-- build the jdbc-pool source jar--> + <echo message="Building Tomcat JDBC pool src JAR"/> + <ant antfile="${tomcat.jdbc.dir}/build.xml" dir="${tomcat.jdbc.dir}" +@@ -1227,9 +1232,11 @@ + + <copy file="${basedir}/LICENSE" todir="${tomcat.embed}" /> + <copy file="${basedir}/NOTICE" todir="${tomcat.embed}" /> ++<!-- + <copy file="${tomcat-dbcp.jar}" todir="${tomcat.embed}" + failonerror="false"/> + <copy file="${jdt.jar}" todir="${tomcat.embed}" /> ++--> + <copy file="${annotations-api.jar}" todir="${tomcat.embed}" /> + + <!-- Note the meta-inf below will work as long as there is only one JAR +@@ -1621,7 +1628,7 @@ + + <target name="extras-commons-logging-prepare" + depends="extras-prepare" +- description="Prepare to build web services extras package"> ++ description="Prepare to build web services extras package" unless="noget"> + + <antcall target="downloadfile-2"> + <param name="sourcefile.1" value="${commons-logging-src.loc.1}"/> +@@ -1775,7 +1782,7 @@ + + <target name="extras-webservices-prepare" + depends="extras-prepare" +- description="Prepare to build web services extras package"> ++ description="Prepare to build web services extras package" unless="noget"> + + <antcall target="downloadfile"> + <param name="sourcefile" value="${jaxrpc-lib.loc}"/> +@@ -1970,11 +1977,12 @@ + </copy> + + <!-- Source bundles for native components --> ++<!-- + <copy tofile="${tomcat.dist}/bin/tomcat-native.tar.gz" + file="${tomcat-native.tar.gz}" /> + <copy tofile="${tomcat.dist}/bin/commons-daemon-native.tar.gz" + file="${commons-daemon.native.src.tgz}" /> +- ++--> + <!-- platform README files --> + <echo append="false" file="${tomcat.dist}/bin/x64/README"> + Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform. +@@ -1984,6 +1992,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform. + + <target name="javadoc" depends="dist-source,extras-webservices-prepare" + description="Create the Tomcat javadoc" > ++<!-- + <javadoc packagenames="javax.servlet.*" + excludepackagenames="javax.servlet.jsp.*" + sourcepath="${tomcat.dist}/src/java" +@@ -2045,6 +2054,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform. + <path location="${ant.core.lib}"/> + </classpath> + </javadoc> ++--> + <javadoc packagenames="javax.websocket.*" + sourcepath="${tomcat.dist}/src/java" + destdir="${tomcat.dist}/webapps/docs/websocketapi" +@@ -2083,9 +2093,11 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform. + <path refid="tomcat.webservices.classpath"/> + <path location="${ant.core.lib}"/> + </classpath> ++<!-- + <link href="../servletapi"/> + <link href="../jspapi"/> + <link href="../elapi"/> ++--> + <link href="../websocketapi"/> + <link href="http://docs.oracle.com/javase/7/docs/api/"/> + <link href="https://commons.apache.org/proper/commons-io/javadocs/api-release/"/> +@@ -2821,7 +2833,7 @@ skip.installer property in build.properties" /> + </target> + + <target name="download-compile" +- description="Download (and build) components necessary to compile" > ++ description="Download (and build) components necessary to compile" unless="noget"> + + <!-- Download Commons Daemon --> + <antcall target="downloadgz-2"> +@@ -2847,7 +2859,7 @@ skip.installer property in build.properties" /> + </target> + + <target name="download-test-compile" +- description="Download additional components for the tests" > ++ description="Download additional components for the tests" unless="noget"> + + <antcall target="downloadfile"> + <param name="sourcefile" value="${junit.loc}"/> +@@ -2925,7 +2937,7 @@ skip.installer property in build.properties" /> + </target> + + <target name="download-dist" +- description="Download additional components for a distribution" > ++ description="Download additional components for a distribution" unless="noget"> + + <antcall target="downloadfile-2"> + <param name="sourcefile.1" value="${tomcat-native.loc.1}"/> +@@ -2980,13 +2992,13 @@ skip.installer property in build.properties" /> + + <!-- =============== Utility Targets to support downloads ================ --> + +- <target name="setproxy" if="${proxy.use}"> ++ <target name="setproxy" if="${proxy.use}" unless="noger"> + <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" + proxyuser="${proxy.user}" proxypassword="${proxy.password}" /> + <echo message="Using ${proxy.host}:${proxy.port} to download ${sourcefile}"/> + </target> + +- <target name="testexist"> ++ <target name="testexist" unless="noget"> + <echo message="Testing for ${destfile}"/> + <available file="${destfile}" property="exist"/> + </target> +@@ -3108,7 +3120,7 @@ skip.installer property in build.properties" /> + </sequential> + </macrodef> + +- <target name="downloadgz" unless="exist" depends="testexist,setproxy"> ++ <target name="downloadgz" unless="noget" depends="testexist,setproxy"> + <!-- Download and extract the package --> + <local name="temp.file"/> + <mkdir dir="${base.path}"/> +@@ -3125,7 +3137,7 @@ skip.installer property in build.properties" /> + <delete file="${temp.file}.tar.gz"/> + </target> + +- <target name="downloadgz-2" unless="exist" depends="testexist"> ++ <target name="downloadgz-2" unless="noget" depends="testexist"> + <!-- Download and extract the package from the two alternative locations --> + <local name="temp.file"/> + <mkdir dir="${base.path}"/> +@@ -3150,7 +3162,7 @@ skip.installer property in build.properties" /> + <delete file="${temp.file}.tar.gz"/> + </target> + +- <target name="downloadzip" unless="exist" depends="testexist,setproxy"> ++ <target name="downloadzip" unless="noget" depends="testexist,setproxy"> + <!-- Download and extract the package --> + <local name="temp.file"/> + <mkdir dir="${base.path}"/> +@@ -3166,7 +3178,7 @@ skip.installer property in build.properties" /> + <delete file="${temp.file}"/> + </target> + +- <target name="downloadzip-2" unless="exist" depends="testexist"> ++ <target name="downloadzip-2" unless="noget" depends="testexist"> + <!-- Download and extract the package from the two alternative locations --> + <local name="temp.file"/> + <mkdir dir="${base.path}"/> +@@ -3190,7 +3202,7 @@ skip.installer property in build.properties" /> + <delete file="${temp.file}"/> + </target> + +- <target name="downloadfile" unless="exist" depends="testexist,setproxy"> ++ <target name="downloadfile" unless="noget" depends="testexist,setproxy"> + <!-- Download the file --> + <local name="temp.file"/> + <mkdir dir="${base.path}"/> +@@ -3205,7 +3217,7 @@ skip.installer property in build.properties" /> + <move file="${temp.file}" tofile="${destfile}"/> + </target> + +- <target name="downloadfile-2" unless="exist" depends="testexist"> ++ <target name="downloadfile-2" unless="noget" depends="testexist"> + <!-- Download the file from the two alternative locations --> + <local name="temp.file"/> + <mkdir dir="${base.path}"/> +@@ -3233,7 +3245,7 @@ skip.installer property in build.properties" /> + <move file="${temp.file}" tofile="${destfile}"/> + </target> + +- <target name="trydownload.check" depends="setproxy"> ++ <target name="trydownload.check" depends="setproxy" unless="noget"> + <condition property="trydownload.run"> + <and> + <not> +@@ -3244,7 +3256,7 @@ skip.installer property in build.properties" /> + </condition> + </target> + +- <target name="trydownload" if="trydownload.run" depends="trydownload.check"> ++ <target name="trydownload" if="trydownload.run" depends="trydownload.check" unless="noget"> + <!-- Downloads a file if not yet downloaded and the source URL is available --> + <get src="${sourcefile}" httpusecaches="${trydownload.httpusecaches}" dest="${destfile}" /> + </target> +@@ -3255,7 +3267,7 @@ skip.installer property in build.properties" /> + + <target name="ide-eclipse" + depends="download-compile, extras-webservices-prepare, download-test-compile" +- description="Prepares the source tree to be built in Eclipse"> ++ description="Prepares the source tree to be built in Eclipse" unless="noget"> + + <!-- Copy the sample project files into the root directory --> + <copy file="${tomcat.home}/res/ide-support/eclipse/eclipse.project" tofile="${tomcat.home}/.project"/> diff --git a/www-servers/tomcat/files/tomcat-instance-manager-r2.bash b/www-servers/tomcat/files/tomcat-instance-manager-r2.bash new file mode 100644 index 000000000..821101272 --- /dev/null +++ b/www-servers/tomcat/files/tomcat-instance-manager-r2.bash @@ -0,0 +1,270 @@ +#!/bin/bash +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# Author: Ralph Sennhauser <sera@gentoo.org> + +die() { + echo "${@}" + exit 1 +} + +dir_is_empty() { + # usage: + # dir_is_empty <some-dir> + # + # 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 <<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 + 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 --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 + 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' + <?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 diff --git a/www-servers/tomcat/files/tomcat-r1.init b/www-servers/tomcat/files/tomcat-r1.init new file mode 100644 index 000000000..79074f080 --- /dev/null +++ b/www-servers/tomcat/files/tomcat-r1.init @@ -0,0 +1,110 @@ +#!/@GENTOO_PORTAGE_EPREFIX@sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# 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` +export CLASSPATH="${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar" + +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 + + 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 + + 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}" \ + -Dgentoo.classpath="${GCLASSPATH//:/,}" \ + -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 $? +} diff --git a/www-servers/tomcat/files/tomcat.conf b/www-servers/tomcat/files/tomcat.conf new file mode 100644 index 000000000..376af44ad --- /dev/null +++ b/www-servers/tomcat/files/tomcat.conf @@ -0,0 +1,57 @@ +# 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="" + +# Additional paths to put on the default classpath. +# These should be separated by the : character. +# Note: The extra jars listed here will be visible to webapps. +# Example: +# TOMCAT_EXTRA_CLASSPATH="/path/to/foo.jar:/path/to/bar.jar" +# +#TOMCAT_EXTRA_CLASSPATH="" + +# 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="" diff --git a/www-servers/tomcat/metadata.xml b/www-servers/tomcat/metadata.xml new file mode 100644 index 000000000..f8fa41701 --- /dev/null +++ b/www-servers/tomcat/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>fordfrog@gentoo.org</email> + <name>Miroslav Šulc</name> + </maintainer> + <longdescription> + Tomcat is the servlet container that is used in the official Reference + Implementation for the Java Servlet and JavaServer Pages technologies. + The Java Servlet and JavaServer Pages specifications are developed by + Sun under the Java Community Process. + </longdescription> + <use> + <flag name="extra-webapps">Build also the docs and examples webapp</flag> + </use> +</pkgmetadata> diff --git a/www-servers/tomcat/tomcat-8.0.53.ebuild b/www-servers/tomcat/tomcat-8.0.53.ebuild new file mode 100644 index 000000000..298aa96f8 --- /dev/null +++ b/www-servers/tomcat/tomcat-8.0.53.ebuild @@ -0,0 +1,159 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +JAVA_PKG_IUSE="doc source test" + +inherit eutils java-pkg-2 java-ant-2 prefix user + +MY_P="apache-${P}-src" + +DESCRIPTION="Tomcat Servlet-3.1/JSP-2.3/EL-3.0/WebSocket-1.1 Container" +HOMEPAGE="https://tomcat.apache.org/" +SRC_URI="mirror://apache/${PN}/tomcat-8/v${PV}/src/${MY_P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="8" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x86-solaris" +IUSE="extra-webapps" + +RESTRICT="test" # can we run them on a production system? + +ECJ_SLOT="4.5" +SAPI_SLOT="3.1" + +COMMON_DEP="dev-java/eclipse-ecj:${ECJ_SLOT} + dev-java/tomcat-servlet-api:${SAPI_SLOT}" +RDEPEND="${COMMON_DEP} + !<dev-java/tomcat-native-1.1.24 + >=virtual/jre-1.7" +DEPEND="${COMMON_DEP} + app-admin/pwgen + >=dev-java/ant-core-1.9.13 + >=virtual/jdk-1.7 + test? ( + >=dev-java/ant-junit-1.9:0 + dev-java/easymock:3.2 + )" + +S=${WORKDIR}/${MY_P} + +pkg_setup() { + java-pkg-2_pkg_setup + enewgroup tomcat 265 + enewuser tomcat 265 -1 /dev/null tomcat +} + +src_prepare() { + default + + find -name '*.jar' -type f -delete -print || die + + # Remove bundled servlet-api + rm -rv java/javax/{el,servlet} || die + + eapply "${FILESDIR}/${P}-build.xml.patch" + + # 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 + + java-pkg-2_src_prepare +} + +JAVA_ANT_REWRITE_CLASSPATH="true" + +EANT_BUILD_TARGET="deploy" +EANT_GENTOO_CLASSPATH="eclipse-ecj-${ECJ_SLOT},tomcat-servlet-api-${SAPI_SLOT}" +EANT_TEST_GENTOO_CLASSPATH="easymock-3.2" +EANT_GENTOO_CLASSPATH_EXTRA="${S}/output/classes" +EANT_NEEDS_TOOLS="true" +EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false" + +# revisions of the scripts +IM_REV="-r2" +INIT_REV="-r1" + +src_compile() { + EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)" + java-pkg-2_src_compile +} + +src_test() { + java-pkg-2_src_test +} + +src_install() { + local dest="/usr/share/${PN}-${SLOT}" + + java-pkg_jarinto "${dest}"/bin + java-pkg_dojar output/build/bin/*.jar + exeinto "${dest}"/bin + doexe output/build/bin/*.sh + + java-pkg_jarinto "${dest}"/lib + java-pkg_dojar output/build/lib/*.jar + + dodoc RELEASE-NOTES RUNNING.txt + use doc && java-pkg_dojavadoc output/dist/webapps/docs/api + use source && java-pkg_dosrc java/* + + ### Webapps ### + + # add missing docBase + local apps="host-manager manager" + for app in ${apps}; do + sed -i -e "s|=\"true\" >|=\"true\" docBase=\"\$\{catalina.home\}/webapps/${app}\" >|" \ + output/build/webapps/${app}/META-INF/context.xml || die + done + + insinto "${dest}"/webapps + doins -r output/build/webapps/{host-manager,manager,ROOT} + use extra-webapps && doins -r output/build/webapps/{docs,examples} + + ### Config ### + + # create "logs" directory in $CATALINA_BASE + # and set correct perms, see #458890 + dodir "${dest}"/logs + fperms 0750 "${dest}"/logs + + # replace the default pw with a random one, see #92281 + local randpw="$(pwgen -s -B 15 1)" + sed -i -e "s|SHUTDOWN|${randpw}|" output/build/conf/server.xml || die + + # prepend gentoo.classpath to common.loader, see #453212 + sed -i -e 's/^common\.loader=/\0${gentoo.classpath},/' output/build/conf/catalina.properties || die + + insinto "${dest}" + doins -r output/build/conf + + ### 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 + + 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 +} + +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}/usr/share/${PN}-${SLOT}/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" + + einfo "Please read https://wiki.gentoo.org/wiki/Apache_Tomcat and" + einfo "https://wiki.gentoo.org/wiki/Project:Java/Tomcat_6_Guide for more information." +} |