diff --git a/tools-ng/README b/tools-ng/README index c0d2b1058..ffd94eaf7 100644 --- a/tools-ng/README +++ b/tools-ng/README @@ -5,7 +5,6 @@ Next Generation Tools This dir is home of tools for development, installation and maintenance of new CCM / APLAWS, standards compliant deployment and execution context. -CURRENTLY EVERYTHING HERE IS WORK IN PROGRESS common/ Library of files and schemes which may be used by several development @@ -15,6 +14,10 @@ devel/ Library of files which are requirred by either the test runtime or the compiler to do its work (e.g. jdbc drivers). +distribution/ + Several Files to create software distribution, esp. RPM distribution + files. + ecdc/ Easy CCM Development Configuration (ECDC) A simplified development environment with minimal installation and @@ -27,9 +30,8 @@ maven/ netbeans/ Netbeans integration. Project file which defines all CCM packages. -user/ - User's installation and maintenance tools - Comming soon. +webxml/ + Utilitiy classes to create a web.xml file from package stub files. README This file diff --git a/tools-ng/distribution/aplaws/rpm/HowToMake.README b/tools-ng/distribution/aplaws/rpm/HowToMake.README new file mode 100644 index 000000000..0e067f22d --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/HowToMake.README @@ -0,0 +1,15 @@ + +Creating Patch files +==================== + +(1) Edit the file to be patched in the same directory as the original file +keeping it as *.bak or similiar. The location must be in the rpm build +area relativ to RPM_BUILD_DIR (where the sources are unpacked) because the +patch is performed during the prep step. + +(2) use diff -Naur [oldFileVersion] [newFileVersion] > File.patch + +(3) Copy the *.patch file into distribution source directory (usually +somethink like ~/rpm/SOURCE) and keep it in this svn repository directory + +(4) Add a line "Patchx File.Patch to the spec file. diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/apache-tomcat-6.0.32.tar.gz b/tools-ng/distribution/aplaws/rpm/SOURCE/apache-tomcat-6.0.32.tar.gz new file mode 100644 index 000000000..be192ee10 Binary files /dev/null and b/tools-ng/distribution/aplaws/rpm/SOURCE/apache-tomcat-6.0.32.tar.gz differ diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/apache-tomcat-6.0.35.tar.gz b/tools-ng/distribution/aplaws/rpm/SOURCE/apache-tomcat-6.0.35.tar.gz new file mode 100644 index 000000000..a3fc92293 Binary files /dev/null and b/tools-ng/distribution/aplaws/rpm/SOURCE/apache-tomcat-6.0.35.tar.gz differ diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.0-std.beta1.r2234.src.rpm b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.0-std.beta1.r2234.src.rpm new file mode 100644 index 000000000..c35967652 Binary files /dev/null and b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.0-std.beta1.r2234.src.rpm differ diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.conf b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.conf new file mode 100644 index 000000000..d363ce925 --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.conf @@ -0,0 +1,58 @@ +# System-wide configuration file for APLAWS+ service. +# This will be sourced by APLAWS+ and any of its secondary services. +# Values will be overridden by service-specific configuration +# files in /etc/sysconfig +# +# Use this one to change default values for all services +# Change the service specific ones to affect only one service +# (see, for instance, /etc/sysconfig/tomcat6) +# +# ---------------------------------------------------------- +# Heavily borrowed (i.e. copied) from jpackage.org/Fedora +# Tomcat configuration file tomcat6-6.0.conf. +# All honour granted to jpackage.org and its contributors. +# ---------------------------------------------------------- + +# Where your java installation lives +JAVA_HOME="/usr/lib/jvm/jre" + +# Where your tomcat installation lives +CATALINA_BASE="@@@TCHOME@@@" +CATALINA_HOME="@@@TCHOME@@@" +JASPER_HOME="@@@TCHOME@@@" +CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" +JAVA_OPTS="-Xmx768m -Xms512m -XX:MaxPermSize=256m" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +TOMCAT_USER="@@@TCUSER@@@" +TOMCAT_GROUP="@@@TCUSER@@@-admin" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +CATALINA_PID="/var/run/@@@TCPID@@@.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8080" +CONNECTOR_PORT="8090" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.init b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.init new file mode 100644 index 000000000..1fd0571db --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.init @@ -0,0 +1,348 @@ +#!/bin/bash +# +# aplaws This shell script takes care of starting and stopping the +# embedded Tomcat Servlet Containere for aplaws +# +# Copied from jpackage.org / Fedora Tomcat scripts. All honours granted. +# +# chkconfig: - 80 20 +# +### BEGIN INIT INFO +# Provides: aplaws +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# Default-Start: +# Default-Stop: +# Description: RPM edition of aplaws +# Short-Description: start and stop aplaws +### END INIT INFO +# +# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot +# - heavily rewritten by Deepak Bhole and Jason Corley +# + +## Source function library. +#. /etc/rc.d/init.d/functions +# Source LSB function library. +if [ -r /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +else + exit 1 +fi + +DISTRIB_ID=`lsb_release -i -s 2>/dev/null` + +NAME="$(basename $0)" +unset ISBOOT +if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then + NAME="${NAME:3}" + ISBOOT="1" +fi + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser -s /bin/sh" +else + SU="/bin/su -s /bin/sh" +fi + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/aplaws/aplaws.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${NAME} +fi + +# Define which connector port to use +CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/aplaws" + +# Tomcat program name +TOMCAT_PROG="${NAME}" + +# Define the tomcat username +# Tomcat_USER and ~GROUP are defined in sourced aplaws.conf file! +# TOMCAT_USER="${TOMCAT_USER:-aplaws}" +# TOMCAT_GROUP="${TOMCAT_GROUP:-aplaws-admin}" + +# Define the tomcat log file +TOMCAT_LOG="${TOMCAT_LOG:-/var/log/${NAME}/catalina.out}" + +RETVAL="0" + +# Look for open ports, as the function name might imply +function findFreePorts() { + local isSet1="false" + local isSet2="false" + local isSet3="false" + local lower="8000" + randomPort1="0" + randomPort2="0" + randomPort3="0" + local -a listeners="( $( + netstat -ntl | \ + awk '/^tcp/ {gsub("(.)*:", "", $4); print $4}' + ) )" + while [ "$isSet1" = "false" ] || \ + [ "$isSet2" = "false" ] || \ + [ "$isSet3" = "false" ]; do + let port="${lower}+${RANDOM:0:4}" + if [ -z `expr " ${listeners[*]} " : ".*\( $port \).*"` ]; then + if [ "$isSet1" = "false" ]; then + export randomPort1="$port" + isSet1="true" + elif [ "$isSet2" = "false" ]; then + export randomPort2="$port" + isSet2="true" + elif [ "$isSet3" = "false" ]; then + export randomPort3="$port" + isSet3="true" + fi + fi + done +} + +function makeHomeDir() { + if [ ! -d "$CATALINA_HOME" ]; then + echo "$CATALINA_HOME does not exist, creating" + if [ ! -d "/usr/share/${NAME}" ]; then + mkdir /usr/share/${NAME} + cp -pLR /usr/share/aplaws/* /usr/share/${NAME} + fi + mkdir -p /var/log/${NAME} \ + /var/cache/${NAME} \ + /var/tmp/${NAME} + ln -fs /var/cache/${NAME} ${CATALINA_HOME}/work + ln -fs /var/tmp/${NAME} ${CATALINA_HOME}/temp + ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs + cp -pLR /usr/share/${NAME}/bin $CATALINA_HOME + cp -pLR /usr/share/${NAME}/conf $CATALINA_HOME + ln -fs /usr/share/java/aplaws ${CATALINA_HOME}/lib + ln -fs /usr/share/aplaws/webapps ${CATALINA_HOME}/webapps + chown ${TOMCAT_USER}:${TOMCAT_GROUP} /var/log/${NAME} + fi +} + +function parseOptions() { + options="" + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ + $TOMCAT_CFG + )" + if [ -r "/etc/sysconfig/${NAME}" ]; then + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; + print "export ", $0, ";" }' \ + /etc/sysconfig/${NAME} + )" + fi + TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}" +} + +# See how we were called. +function start() { + + echo -n "Starting ${TOMCAT_PROG}: " + if [ "$RETVAL" != "0" ]; then + log_failure_msg + return + fi + if [ -f "/var/lock/subsys/${NAME}" ]; then + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid +# if checkpid $kpid 2>&1; then + if [ -d "/proc/${kpid}" ]; then + log_success_msg + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi + RETVAL="0" + return + fi + fi + fi + # fix permissions on the log and pid files + export CATALINA_PID="/var/run/${NAME}.pid" + touch $CATALINA_PID 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_GROUP} $CATALINA_PID + fi + [ "$RETVAL" -eq "0" ] && touch $TOMCAT_LOG 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_GROUP} $TOMCAT_LOG + fi + if [ "$CATALINA_HOME" != "/usr/share/aplaws" -a "$RETVAL" -eq "0" ]; then + # Create an aplaws directory if it doesn't exist + makeHomeDir + # If CATALINA_HOME doesn't exist modify port number so that + # multiple instances don't interfere with each other + findFreePorts + sed -i -e "s/8015/${randomPort1}/g" -e "s/8090/${CONNECTOR_PORT}/g" \ + -e "s/8019/${randomPort2}/g" -e "s/8453/${randomPort3}/g" \ + ${CATALINA_HOME}/conf/server.xml + fi + parseOptions + if [ "$RETVAL" -eq "0" -a "$SECURITY_MANAGER" = "true" ]; then + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security ${TOMCAT_LOG}" \ + >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4" + else + + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start ${TOMCAT_LOG}" >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + log_success_msg + touch /var/lock/subsys/${NAME} + else + log_failure_msg "Error code ${RETVAL}" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function stop() { + echo -n "Stopping ${TOMCAT_PROG}: " + if [ -f "/var/lock/subsys/${NAME}" ]; then + parseOptions + if [ "$RETVAL" -eq "0" ]; then + touch /var/lock/subsys/${NAME} 2>&1 || RETVAL="4" + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop ${TOMCAT_LOG}" >> /var/log/${NAME}/initd.out 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + count="0" + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ + [ "$count" -gt "$SHUTDOWN_WAIT" ]; do + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + echo "waiting for processes $kpid to exit" + fi + sleep 1 + let count="${count}+1" + done + if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + log_warning_msg "killing processes which did not stop after ${SHUTDOWN_WAIT} seconds" + fi + kill -9 $kpid + fi + log_success_msg + fi + rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid + else + log_failure_msg + RETVAL="4" + fi + else + log_success_msg + RETVAL="0" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function status() +{ + checkpidfile + if [ "$RETVAL" -eq "0" ]; then + log_success_msg "${NAME} (pid ${kpid}) is running..." + elif [ "$RETVAL" -eq "1" ]; then + log_failure_msg "PID file exists, but process is not running" + else + checklockfile + if [ "$RETVAL" -eq "2" ]; then + log_failure_msg "${NAME} lockfile exists but process is not running" + else + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" + if [ -z "$pid" ]; then + log_success_msg "${NAME} is stopped" + RETVAL="3" + else + log_success_msg "${NAME} (pid $pid) is running..." + RETVAL="0" + fi + fi + fi +} + +function checklockfile() +{ + if [ -f /var/lock/subsys/${NAME} ]; then + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" +# The lockfile exists but the process is not running + if [ -z "$pid" ]; then + RETVAL="2" + fi + fi +} + +function checkpidfile() +{ + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + if [ -d "/proc/${kpid}" ]; then +# The pid file exists and the process is running + RETVAL="0" + else +# The pid file exists but the process is not running + RETVAL="1" + return + fi + fi +# pid file does not exist and program is not running + RETVAL="3" +} + +function usage() +{ + echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" + RETVAL="2" +} + +# See how we were called. +RETVAL="0" +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + reload) + RETVAL="3" + ;; + force-reload) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + status) + status + ;; + version) + ${TOMCAT_SCRIPT} version + ;; + *) + usage + ;; +esac + +exit $RETVAL diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.logrotate b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.logrotate new file mode 100644 index 000000000..4e5856b6d --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.logrotate @@ -0,0 +1,8 @@ +@@@TCLOG@@@/catalina.out { + copytruncate + weekly + rotate 52 + compress + missingok + create 0644 aplaws aplaws-admin +} diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.sysconfig b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.sysconfig new file mode 100644 index 000000000..33ed564b2 --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.sysconfig @@ -0,0 +1,63 @@ +# Service-wide configuration file for APLAWS+ service. +# This will be sourced by APLAWS+ init script after the system-wide configuration +# file /etc/aplaws/aplaws.conf, thus allowing values to be overridden in a +# per-service manner. +# +# NEVER change the init script itself. To change values for all services make +# your changes in /etc/aplaws/aplaws.conf! +# +# To change values for a specific service make your edits here. +# To create a new service create a link from /etc/init.d/ to +# /etc/init.d/aplaws (do not copy the init script) and make a copy of the +# /etc/sysconfig/aplaws file to /etc/sysconfig/ and change +# the property values so the two services won't conflict. Register the new +# service in the system as usual (see chkconfig and similars). +# +# +# ---------------------------------------------------------- +# Heavily borrowed (i.e. copied) from jpackage.org/Fedora +# Tomcat configuration file tomcat6-6.0.sysconfig. +# All honour granted to jpackage.org and its contributors. +# ---------------------------------------------------------- + +# Where your java installation lives +#JAVA_HOME="/usr/lib/jvm/jre" + +# Where your tomcat installation lives +#CATALINA_BASE="@@@TCHOME@@@" +#CATALINA_HOME="@@@TCHOME@@@" +#JASPER_HOME="@@@TCHOME@@@" +#CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xmx768m -Xms512m -XX:MaxPermSize=256m" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +#TOMCAT_USER="@@@TCUSER@@@" +#TOMCAT_GROUP="@@@TCUSER@@@-admin" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +#SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +#SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +#SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +#CATALINA_PID="/var/run/@@@TCPID@@@.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8090" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.wrapper b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.wrapper new file mode 100644 index 000000000..81288b16b --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SOURCE/aplaws-2.0.wrapper @@ -0,0 +1,65 @@ +#!/bin/bash + +if [ -r /usr/share/java-utils/java-functions ]; then + . /usr/share/java-utils/java-functions +else + echo "Can't read Java functions library, aborting" + exit 1 +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +CLASSPATH="${CLASSPATH}:$(build-classpath commons-daemon 2>/dev/null)" + +if [ "$1" = "start" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "start-security" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.security.manager \ + -Djava.security.policy=="${CATALINA_BASE}/conf/catalina.policy" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "stop" ]; then + ${JAVACMD} $JAVA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap stop \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 +elif [ "$1" = "version" ]; then + ${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \ + org.apache.catalina.util.ServerInfo +else + echo "Usage: $0 {start|start-security|stop|version}" + exit 1 +fi diff --git a/tools-ng/distribution/aplaws/rpm/SOURCE/tomcat6-6.0-server-xml.patch b/tools-ng/distribution/aplaws/rpm/SOURCE/tomcat6-6.0-server-xml.patch new file mode 100644 index 000000000..76e52927a --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SOURCE/tomcat6-6.0-server-xml.patch @@ -0,0 +1,59 @@ +--- conf/server.xml.bak 2011-08-20 20:08:54.871251765 +0200 ++++ conf/server.xml 2011-08-20 20:17:57.623539167 +0200 +@@ -19,7 +19,7 @@ + define subcomponents such as "Valves" at this level. + Documentation at /docs/config/server.html + --> +- ++ + + + +@@ -64,30 +64,30 @@ + Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) + Java AJP Connector: /docs/config/ajp.html + APR (HTTP/AJP) Connector: /docs/apr.html +- Define a non-SSL HTTP/1.1 Connector on port 8080 ++ Define a non-SSL HTTP/1.1 Connector on port 8090 + --> +- ++ redirectPort="8453" /> + + +- + + +- +- ++ ++ + + + + + + ++ ++ ++ ++ ++ + diff --git a/tools-ng/distribution/aplaws/rpm/SPEC/aplaws.spec b/tools-ng/distribution/aplaws/rpm/SPEC/aplaws.spec new file mode 100644 index 000000000..1817eb8ce --- /dev/null +++ b/tools-ng/distribution/aplaws/rpm/SPEC/aplaws.spec @@ -0,0 +1,358 @@ +# Copyright (c) 2000-2009, JPackage Project +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution.// +# 3. Neither the name of the JPackage Project nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# APLAWS+ details +%global bundle compl +%global major_version 2 +%global minor_version 0 +%global micro_version 0 +%global revision beta1.r2321 +%define dist .openccm + +%global apuid 291 +%global arch noarch + +# Servlet Container Details +%global sc_name tomcat6 +%global sc_major_version 6 +%global sc_minor_version 0 +%global sc_micro_version 32 +%global packdname apache-tomcat-%{sc_major_version}.%{sc_minor_version}.%{sc_micro_version} + +%global jspspec 2.1 +%global servletspec 2.5 + +# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ +%global homedir %{_datadir}/%{name} +# FHS: /var/lib dir: state saving data, no user configuration +# /srv dir: site-specific data served by the system, +# read-only data, writable data, scripts +# %global basedir %{_var}/lib/%{name} +%global basedir /srv/%{name} + +%global bindir %{homedir}/bin +%global libdir %{homedir}/lib +%global confdir %{_sysconfdir}/%{name} +%global logdir %{_var}/log/%{name} +%global cachedir %{_var}/cache/%{name} +%global tempdir %{cachedir}/temp +%global workdir %{cachedir}/work +%global webappdir %{basedir}/webapps +%global addondir %{basedir}/ccm-addons +%global initrddir %{_sysconfdir}/init.d + +%global ccmdir /ROOT + +# Avoid RPM 4.2+'s internal dep generator, it may produce bogus +# Provides/Requires here. +%define _use_internal_dependency_generator 0 + +# This prevents aggressive stripping. +%define debug_package %{nil} + +Name: aplaws +Epoch: 0 +Version: %{major_version}.%{minor_version}.%{micro_version} +Release: %{bundle}.%{revision} +Summary: APLAWS+ Collaboration and Content Management System bundled with Tomcat6 servlet container. + +License: LGPL +URL: http://apalaws.org/ +# Tomcat stuff +Source0: apache-tomcat-%{sc_major_version}.%{sc_minor_version}.%{sc_micro_version}.tar.gz +Source1: %{name}-%{major_version}.%{minor_version}.conf +Source2: %{name}-%{major_version}.%{minor_version}.init +Source3: %{name}-%{major_version}.%{minor_version}.sysconfig +Source4: %{name}-%{major_version}.%{minor_version}.wrapper +Source5: %{name}-%{major_version}.%{minor_version}.logrotate +# Source6: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-digest.script +# Source7: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-tool-wrapper.script +# APLAWS+ stuff +Source8: %{name}-%{bundle}-%{major_version}-%{minor_version}-%{micro_version}-beta-1.war +Source9: postgresql-jdbc-8.4.701.jar +Source10: ojdbc14.jar +Source11: %{name}-%{bundle}-addon-%{major_version}-%{minor_version}-%{micro_version}-beta-1.zip + +Patch0: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-tomcat-users-webapp.patch +Patch1: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-server-xml.patch + +BuildArch: noarch + + +# BuildRequires: ant +# BuildRequires: ant-nodeps +BuildRequires: findutils +# BuildRequires: java-1.6.0-devel +BuildRequires: jpackage-utils >= 0:1.7.0 + +Requires: java-1.6.0 +Requires: procps +Requires(pre): shadow-utils +Requires(pre): shadow-utils +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(post): redhat-lsb +Requires(preun): redhat-lsb +Requires(post): jpackage-utils +Requires(postun): jpackage-utils + + +%description +APLAWS is content and collaboration management web application. + +This package distributes APLAWS with the original, unmodified binary +Apache Tomcat distribution integrated in a FHS compliant structure and +includes configuration and helper files to start Tomcat during systems +init process. + +# -------------------------------------------------------------------------- + +%package addons +Summary: Provides additional packages not included in the APLAWS ${bundle} bundle. +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description addons +Provides additional packages not included in the APLAWS ${bundle} bundle. + +# -------------------------------------------------------------------------- + + + +%prep + +%setup -n %{packdname} -q +chmod -R go=u-w * +chmod -R u+w * + +# remove pre-built binaries and windows files +find . -type f \( \ + -name "*.bat" -o \ + -name "*.gz" -o \ + -name "*.war" -o \ + -name "*.zip" -o \ + -name "Thumbs.db" \) | xargs -t %{__rm} + +# excluded in order to provide the managers class files +# -name "*.class" -o \ + +%patch0 -p0 +%patch1 -p0 + +rm -rf webapps/docs +rm -rf webapps/examples +rm -rf webapps/ROOT/* +%{__cp} %{SOURCE9} lib/ +%{__cp} %{SOURCE10} lib/ + +# unpack ccm application +cd webapps/ROOT/ +unzip %{SOURCE8} +cd ../.. + +mkdir addons +cd addons/ +unzip %{SOURCE11} + + + +%build + +# Nope. + + +%install +rm -rf $RPM_BUILD_ROOT + +# build initial path structure +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{initrddir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir} +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir} +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}/Catalina/localhost +%{__install} -d -m 2755 ${RPM_BUILD_ROOT}%{webappdir} +%{__install} -d -m 2755 ${RPM_BUILD_ROOT}%{addondir} +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir} +/bin/touch ${RPM_BUILD_ROOT}%{logdir}/catalina.out +%{__install} -d -m 2775 ${RPM_BUILD_ROOT}%{tempdir} +%{__install} -d -m 2775 ${RPM_BUILD_ROOT}%{workdir} + +# move things into place +# tomcat stuff first +# pushd %--{packdname} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/LICENSE ${RPM_BUILD_ROOT}/%{homedir}/ + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/NOTICE ${RPM_BUILD_ROOT}/%{homedir}/ + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/RELEASE* ${RPM_BUILD_ROOT}/%{homedir}/ + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/lib/*.jar ${RPM_BUILD_ROOT}%{libdir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/webapps/* ${RPM_BUILD_ROOT}%{webappdir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/addons/* ${RPM_BUILD_ROOT}%{addondir} +# popd + + +# supporting files for configuration, init etc. +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" \ + -e "s|\@\@\@TCPID\@\@\@|%{name}|g" \ + -e "s|\@\@\@TCUSER\@\@\@|%{name}|g" %{SOURCE1} \ + > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf + +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" \ + -e "s|\@\@\@TCPID\@\@\@|%{name}|g" \ + -e "s|\@\@\@TCUSER\@\@\@|%{name}|g" %{SOURCE3} \ + > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} + +%{__install} -m 0644 %{SOURCE2} \ + ${RPM_BUILD_ROOT}%{initrddir}/%{name} + +%{__install} -m 0644 %{SOURCE4} \ + ${RPM_BUILD_ROOT}%{_sbindir}/%{name} +%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} + +%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \ + > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name} + +# %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ +# -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ +# -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \ +# > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest + +# %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ +# -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ +# -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \ +# > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper + +# symlink to the FHS locations where we've installed things +pushd ${RPM_BUILD_ROOT}%{homedir} + %{__ln_s} %{confdir} conf + %{__ln_s} %{logdir} logs + %{__ln_s} %{tempdir} temp + %{__ln_s} %{workdir} work + %{__ln_s} %{webappdir} webapps +popd + + + +%pre +# add the aplaws user and group +%{_sbindir}/groupadd -g %{apuid} -r aplaws-admin 2>/dev/null || : +%{_sbindir}/useradd -c "APLAWS+" -u %{apuid} -g nobody -N \ + -s /bin/bash -r -d %{homedir} aplaws 2>/dev/null || : + + +%post +# install but don't activate +/sbin/chkconfig --add %{name} + + +%preun +# clean tempdir and workdir on removal or upgrade +%{__rm} -rf %{workdir} %{tempdir} +if [ "$1" = "0" ]; then + %{initrddir}/%{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi + +# base package +%files +%defattr(0664,root,root,0775) +# % % doc {LICENSE,NOTICE,RELEASE*} + +# attribute flags for rpm support and config files +# %attr(0755,root,root) %{_bindir}/%{name}-digest +# %attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper +%attr(0755,root,root) %{_sbindir}/d%{name} +%attr(0755,root,root) %{_sbindir}/%{name} +%attr(0755,root,root) %{initrddir}/%{name} +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} + +# attribute flags for basic tomcat directories and config files +%attr(2775,aplaws,aplaws-admin) %dir %{basedir} +%attr(7775,aplaws,aplaws-admin) %dir %{webappdir} +%attr(0775,aplaws,aplaws-admin) %dir %{cachedir} +%attr(0775,aplaws,aplaws-admin) %dir %{tempdir} +%attr(0775,aplaws,aplaws-admin) %dir %{workdir} +# (from sl spec) +%attr(0775,aplaws,aplaws-admin) %dir %{logdir} +%attr(0644,aplaws,aplaws-admin) %{logdir}/catalina.out + +%attr(0775,root,aplaws-admin) %dir %{confdir} +%attr(0775,root,aplaws-admin) %dir %{confdir}/Catalina +%attr(0775,root,aplaws-admin) %dir %{confdir}/Catalina/localhost +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/%{name}.conf +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/*.policy +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/*.properties +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/context.xml +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/server.xml +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/tomcat-users.xml +%attr(0666,aplaws,aplaws-admin) %config(noreplace) %{confdir}/web.xml + +%dir %{homedir} +# specify files to include in package for installation +%defattr(0664,aplaws,aplaws-admin,0775) +%{homedir}/LICENSE +%{homedir}/NOTICE +%{homedir}/RELEASE* +%{homedir}/bin +%{homedir}/lib +%{homedir}/temp +%{homedir}/webapps +%{homedir}/work +%{homedir}/logs +%{homedir}/conf + +# %files admin-webapps +%defattr(0664,aplaws,aplaws-admin,0775) +%{webappdir}/host-manager +%{webappdir}/manager + +#%files webapps +%defattr(0664,aplaws,aplaws-admin,0775) +%{webappdir}/ROOT + +%files addons +%defattr(0664,aplaws,aplaws-admin,0775) +%{addondir} + + + +%changelog +* Thu May 17 2012 Peter Boy 0:2.0.0-1 +- Initial release, heavily borrowed from jpp, Scientific Linux, + and especially Fedora 16 diff --git a/tools-ng/distribution/originals/tomcat6-6.0-digest.script b/tools-ng/distribution/originals/tomcat6-6.0-digest.script new file mode 100644 index 000000000..41ef58e9b --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0-digest.script @@ -0,0 +1,45 @@ +#!/bin/sh +# +# tomcat6-digest script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find functions library, aborting" + exit 1 +fi + +# Get the tomcat config (use this for environment specific settings) +if [ -z "${TOMCAT_CFG}" ]; then + TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +fi + +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +export CLASSPATH + +# Configuration +MAIN_CLASS="org.apache.catalina.startup.Tool" +BASE_FLAGS="-Dcatalina.home=\"$CATALINA_HOME\"" +BASE_OPTIONS="" +BASE_JARS="commons-daemon tomcat6/catalina servlet" + +# Set parameters +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run -server org.apache.catalina.realm.RealmBase "$@" diff --git a/tools-ng/distribution/originals/tomcat6-6.0-tool-wrapper.script b/tools-ng/distribution/originals/tomcat6-6.0-tool-wrapper.script new file mode 100644 index 000000000..bcd7561f8 --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0-tool-wrapper.script @@ -0,0 +1,45 @@ +#!/bin/sh +# +# tomcat6-digest script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find functions library, aborting" + exit 1 +fi + +# Get the tomcat config (use this for environment specific settings) +if [ -z "${TOMCAT_CFG}" ]; then + TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +fi + +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +export CLASSPATH + +# Configuration +MAIN_CLASS="org.apache.catalina.startup.Tool" +BASE_OPTIONS="" +BASE_FLAGS="-Dcatalina.home=\"$CATALINA_HOME\"" +BASE_JARS="commons-daemon tomcat6/catalina servlet" + +# Set parameters +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run "$@" diff --git a/tools-ng/distribution/originals/tomcat6-6.0.conf b/tools-ng/distribution/originals/tomcat6-6.0.conf new file mode 100644 index 000000000..f2fe56eac --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0.conf @@ -0,0 +1,50 @@ +# System-wide configuration file for tomcat6 services +# This will be sourced by tomcat6 and any secondary service +# Values will be overridden by service-specific configuration +# files in /etc/sysconfig +# +# Use this one to change default values for all services +# Change the service specific ones to affect only one service +# (see, for instance, /etc/sysconfig/tomcat6) +# + +# Where your java installation lives +JAVA_HOME="/usr/lib/jvm/jre" + +# Where your tomcat installation lives +CATALINA_BASE="@@@TCHOME@@@" +CATALINA_HOME="@@@TCHOME@@@" +JASPER_HOME="@@@TCHOME@@@" +CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +TOMCAT_USER="tomcat" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +CATALINA_PID="/var/run/tomcat6.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8080" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tools-ng/distribution/originals/tomcat6-6.0.init b/tools-ng/distribution/originals/tomcat6-6.0.init new file mode 100644 index 000000000..f5ee3a15d --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0.init @@ -0,0 +1,343 @@ +#!/bin/bash +# +# tomcat6 This shell script takes care of starting and stopping Tomcat +# +# chkconfig: - 80 20 +# +### BEGIN INIT INFO +# Provides: tomcat6 +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# Default-Start: +# Default-Stop: +# Description: Release implementation for Servlet 2.5 and JSP 2.1 +# Short-Description: start and stop tomcat +### END INIT INFO +# +# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot +# - heavily rewritten by Deepak Bhole and Jason Corley +# + +## Source function library. +#. /etc/rc.d/init.d/functions +# Source LSB function library. +if [ -r /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +else + exit 1 +fi + +DISTRIB_ID=`lsb_release -i -s 2>/dev/null` + +NAME="$(basename $0)" +unset ISBOOT +if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then + NAME="${NAME:3}" + ISBOOT="1" +fi + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser -s /bin/sh" +else + SU="/bin/su -s /bin/sh" +fi + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${NAME} +fi + +# Define which connector port to use +CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/tomcat6" + +# Tomcat program name +TOMCAT_PROG="${NAME}" + +# Define the tomcat username +TOMCAT_USER="${TOMCAT_USER:-tomcat}" + +# Define the tomcat log file +TOMCAT_LOG="${TOMCAT_LOG:-/var/log/${NAME}/catalina.out}" + +RETVAL="0" + +# Look for open ports, as the function name might imply +function findFreePorts() { + local isSet1="false" + local isSet2="false" + local isSet3="false" + local lower="8000" + randomPort1="0" + randomPort2="0" + randomPort3="0" + local -a listeners="( $( + netstat -ntl | \ + awk '/^tcp/ {gsub("(.)*:", "", $4); print $4}' + ) )" + while [ "$isSet1" = "false" ] || \ + [ "$isSet2" = "false" ] || \ + [ "$isSet3" = "false" ]; do + let port="${lower}+${RANDOM:0:4}" + if [ -z `expr " ${listeners[*]} " : ".*\( $port \).*"` ]; then + if [ "$isSet1" = "false" ]; then + export randomPort1="$port" + isSet1="true" + elif [ "$isSet2" = "false" ]; then + export randomPort2="$port" + isSet2="true" + elif [ "$isSet3" = "false" ]; then + export randomPort3="$port" + isSet3="true" + fi + fi + done +} + +function makeHomeDir() { + if [ ! -d "$CATALINA_HOME" ]; then + echo "$CATALINA_HOME does not exist, creating" + if [ ! -d "/usr/share/${NAME}" ]; then + mkdir /usr/share/${NAME} + cp -pLR /usr/share/tomcat6/* /usr/share/${NAME} + fi + mkdir -p /var/log/${NAME} \ + /var/cache/${NAME} \ + /var/tmp/${NAME} + ln -fs /var/cache/${NAME} ${CATALINA_HOME}/work + ln -fs /var/tmp/${NAME} ${CATALINA_HOME}/temp + ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs + cp -pLR /usr/share/${NAME}/bin $CATALINA_HOME + cp -pLR /usr/share/${NAME}/conf $CATALINA_HOME + ln -fs /usr/share/java/tomcat6 ${CATALINA_HOME}/lib + ln -fs /usr/share/tomcat6/webapps ${CATALINA_HOME}/webapps + chown ${TOMCAT_USER}:root /var/log/${NAME} + fi +} + +function parseOptions() { + options="" + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ + $TOMCAT_CFG + )" + if [ -r "/etc/sysconfig/${NAME}" ]; then + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; + print "export ", $0, ";" }' \ + /etc/sysconfig/${NAME} + )" + fi + TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}" +} + +# See how we were called. +function start() { + + echo -n "Starting ${TOMCAT_PROG}: " + if [ "$RETVAL" != "0" ]; then + log_failure_msg + return + fi + if [ -f "/var/lock/subsys/${NAME}" ]; then + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid +# if checkpid $kpid 2>&1; then + if [ -d "/proc/${kpid}" ]; then + log_success_msg + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi + RETVAL="0" + return + fi + fi + fi + # fix permissions on the log and pid files + export CATALINA_PID="/var/run/${NAME}.pid" + touch $CATALINA_PID 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID + fi + [ "$RETVAL" -eq "0" ] && touch $TOMCAT_LOG 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG + fi + if [ "$CATALINA_HOME" != "/usr/share/tomcat6" -a "$RETVAL" -eq "0" ]; then + # Create a tomcat directory if it doesn't exist + makeHomeDir + # If CATALINA_HOME doesn't exist modify port number so that + # multiple instances don't interfere with each other + findFreePorts + sed -i -e "s/8005/${randomPort1}/g" -e "s/8080/${CONNECTOR_PORT}/g" \ + -e "s/8009/${randomPort2}/g" -e "s/8443/${randomPort3}/g" \ + ${CATALINA_HOME}/conf/server.xml + fi + parseOptions + if [ "$RETVAL" -eq "0" -a "$SECURITY_MANAGER" = "true" ]; then + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security ${TOMCAT_LOG}" \ + >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4" + else + + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start ${TOMCAT_LOG}" >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + log_success_msg + touch /var/lock/subsys/${NAME} + else + log_failure_msg "Error code ${RETVAL}" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function stop() { + echo -n "Stopping ${TOMCAT_PROG}: " + if [ -f "/var/lock/subsys/${NAME}" ]; then + parseOptions + if [ "$RETVAL" -eq "0" ]; then + touch /var/lock/subsys/${NAME} 2>&1 || RETVAL="4" + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop ${TOMCAT_LOG}" >> /var/log/${NAME}/initd.out 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + count="0" + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ + [ "$count" -gt "$SHUTDOWN_WAIT" ]; do + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + echo "waiting for processes $kpid to exit" + fi + sleep 1 + let count="${count}+1" + done + if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + log_warning_msg "killing processes which did not stop after ${SHUTDOWN_WAIT} seconds" + fi + kill -9 $kpid + fi + log_success_msg + fi + rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid + else + log_failure_msg + RETVAL="4" + fi + else + log_success_msg + RETVAL="0" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function status() +{ + checkpidfile + if [ "$RETVAL" -eq "0" ]; then + log_success_msg "${NAME} (pid ${kpid}) is running..." + elif [ "$RETVAL" -eq "1" ]; then + log_failure_msg "PID file exists, but process is not running" + else + checklockfile + if [ "$RETVAL" -eq "2" ]; then + log_failure_msg "${NAME} lockfile exists but process is not running" + else + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" + if [ -z "$pid" ]; then + log_success_msg "${NAME} is stopped" + RETVAL="3" + else + log_success_msg "${NAME} (pid $pid) is running..." + RETVAL="0" + fi + fi + fi +} + +function checklockfile() +{ + if [ -f /var/lock/subsys/${NAME} ]; then + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" +# The lockfile exists but the process is not running + if [ -z "$pid" ]; then + RETVAL="2" + fi + fi +} + +function checkpidfile() +{ + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + if [ -d "/proc/${kpid}" ]; then +# The pid file exists and the process is running + RETVAL="0" + else +# The pid file exists but the process is not running + RETVAL="1" + return + fi + fi +# pid file does not exist and program is not running + RETVAL="3" +} + +function usage() +{ + echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" + RETVAL="2" +} + +# See how we were called. +RETVAL="0" +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + reload) + RETVAL="3" + ;; + force-reload) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + status) + status + ;; + version) + ${TOMCAT_SCRIPT} version + ;; + *) + usage + ;; +esac + +exit $RETVAL diff --git a/tools-ng/distribution/originals/tomcat6-6.0.logrotate b/tools-ng/distribution/originals/tomcat6-6.0.logrotate new file mode 100644 index 000000000..a87b4c005 --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0.logrotate @@ -0,0 +1,8 @@ +@@@TCLOG@@@/catalina.out { + copytruncate + weekly + rotate 52 + compress + missingok + create 0644 tomcat tomcat +} diff --git a/tools-ng/distribution/originals/tomcat6-6.0.sysconfig b/tools-ng/distribution/originals/tomcat6-6.0.sysconfig new file mode 100644 index 000000000..caefeed9e --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0.sysconfig @@ -0,0 +1,56 @@ +# Service-specific configuration file for tomcat6. This will be sourced by +# the SysV init script after the global configuration file +# /etc/tomcat6/tomcat6.conf, thus allowing values to be overridden in +# a per-service manner. +# +# NEVER change the init script itself. To change values for all services make +# your changes in /etc/tomcat6/tomcat6.conf +# +# To change values for a specific service make your edits here. +# To create a new service create a link from /etc/init.d/ to +# /etc/init.d/tomcat6 (do not copy the init script) and make a copy of the +# /etc/sysconfig/tomcat6 file to /etc/sysconfig/ and change +# the property values so the two services won't conflict. Register the new +# service in the system as usual (see chkconfig and similars). +# + +# Where your java installation lives +#JAVA_HOME="/usr/lib/jvm/java" + +# Where your tomcat installation lives +#CATALINA_BASE="@@@TCHOME@@@" +#CATALINA_HOME="@@@TCHOME@@@" +#JASPER_HOME="@@@TCHOME@@@" +#CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +#TOMCAT_USER="tomcat" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +#SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +#SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +#SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +#CATALINA_PID="/var/run/tomcat6.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8080" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tools-ng/distribution/originals/tomcat6-6.0.wrapper b/tools-ng/distribution/originals/tomcat6-6.0.wrapper new file mode 100644 index 000000000..0e953315a --- /dev/null +++ b/tools-ng/distribution/originals/tomcat6-6.0.wrapper @@ -0,0 +1,74 @@ +#!/bin/bash + +if [ -r /usr/share/java-utils/java-functions ]; then + . /usr/share/java-utils/java-functions +else + echo "Can't read Java functions library, aborting" + exit 1 +fi + +# Get the tomcat config (use this for environment specific settings) +#if [ -z "${TOMCAT_CFG}" ]; then +# TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +#fi + +#if [ -r "$TOMCAT_CFG" ]; then +# . $TOMCAT_CFG +#fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +CLASSPATH="${CLASSPATH}:$(build-classpath commons-daemon 2>/dev/null)" + +if [ "$1" = "start" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "start-security" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.security.manager \ + -Djava.security.policy=="${CATALINA_BASE}/conf/catalina.policy" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "stop" ]; then + ${JAVACMD} $JAVA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap stop \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 +elif [ "$1" = "version" ]; then + ${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \ + org.apache.catalina.util.ServerInfo +else + echo "Usage: $0 {start|start-security|stop|version}" + exit 1 +fi diff --git a/tools-ng/distribution/scientificcms/rpm/HowToMake.README b/tools-ng/distribution/scientificcms/rpm/HowToMake.README new file mode 100644 index 000000000..0e067f22d --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/HowToMake.README @@ -0,0 +1,15 @@ + +Creating Patch files +==================== + +(1) Edit the file to be patched in the same directory as the original file +keeping it as *.bak or similiar. The location must be in the rpm build +area relativ to RPM_BUILD_DIR (where the sources are unpacked) because the +patch is performed during the prep step. + +(2) use diff -Naur [oldFileVersion] [newFileVersion] > File.patch + +(3) Copy the *.patch file into distribution source directory (usually +somethink like ~/rpm/SOURCE) and keep it in this svn repository directory + +(4) Add a line "Patchx File.Patch to the spec file. diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/apache-tomcat-6.0.32.tar.gz b/tools-ng/distribution/scientificcms/rpm/SOURCE/apache-tomcat-6.0.32.tar.gz new file mode 100644 index 000000000..be192ee10 Binary files /dev/null and b/tools-ng/distribution/scientificcms/rpm/SOURCE/apache-tomcat-6.0.32.tar.gz differ diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/apache-tomcat-6.0.35.tar.gz b/tools-ng/distribution/scientificcms/rpm/SOURCE/apache-tomcat-6.0.35.tar.gz new file mode 100644 index 000000000..a3fc92293 Binary files /dev/null and b/tools-ng/distribution/scientificcms/rpm/SOURCE/apache-tomcat-6.0.35.tar.gz differ diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.conf b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.conf new file mode 100644 index 000000000..d363ce925 --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.conf @@ -0,0 +1,58 @@ +# System-wide configuration file for APLAWS+ service. +# This will be sourced by APLAWS+ and any of its secondary services. +# Values will be overridden by service-specific configuration +# files in /etc/sysconfig +# +# Use this one to change default values for all services +# Change the service specific ones to affect only one service +# (see, for instance, /etc/sysconfig/tomcat6) +# +# ---------------------------------------------------------- +# Heavily borrowed (i.e. copied) from jpackage.org/Fedora +# Tomcat configuration file tomcat6-6.0.conf. +# All honour granted to jpackage.org and its contributors. +# ---------------------------------------------------------- + +# Where your java installation lives +JAVA_HOME="/usr/lib/jvm/jre" + +# Where your tomcat installation lives +CATALINA_BASE="@@@TCHOME@@@" +CATALINA_HOME="@@@TCHOME@@@" +JASPER_HOME="@@@TCHOME@@@" +CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" +JAVA_OPTS="-Xmx768m -Xms512m -XX:MaxPermSize=256m" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +TOMCAT_USER="@@@TCUSER@@@" +TOMCAT_GROUP="@@@TCUSER@@@-admin" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +CATALINA_PID="/var/run/@@@TCPID@@@.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8080" +CONNECTOR_PORT="8090" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.init b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.init new file mode 100644 index 000000000..1fd0571db --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.init @@ -0,0 +1,348 @@ +#!/bin/bash +# +# aplaws This shell script takes care of starting and stopping the +# embedded Tomcat Servlet Containere for aplaws +# +# Copied from jpackage.org / Fedora Tomcat scripts. All honours granted. +# +# chkconfig: - 80 20 +# +### BEGIN INIT INFO +# Provides: aplaws +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# Default-Start: +# Default-Stop: +# Description: RPM edition of aplaws +# Short-Description: start and stop aplaws +### END INIT INFO +# +# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot +# - heavily rewritten by Deepak Bhole and Jason Corley +# + +## Source function library. +#. /etc/rc.d/init.d/functions +# Source LSB function library. +if [ -r /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +else + exit 1 +fi + +DISTRIB_ID=`lsb_release -i -s 2>/dev/null` + +NAME="$(basename $0)" +unset ISBOOT +if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then + NAME="${NAME:3}" + ISBOOT="1" +fi + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser -s /bin/sh" +else + SU="/bin/su -s /bin/sh" +fi + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/aplaws/aplaws.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${NAME} +fi + +# Define which connector port to use +CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/aplaws" + +# Tomcat program name +TOMCAT_PROG="${NAME}" + +# Define the tomcat username +# Tomcat_USER and ~GROUP are defined in sourced aplaws.conf file! +# TOMCAT_USER="${TOMCAT_USER:-aplaws}" +# TOMCAT_GROUP="${TOMCAT_GROUP:-aplaws-admin}" + +# Define the tomcat log file +TOMCAT_LOG="${TOMCAT_LOG:-/var/log/${NAME}/catalina.out}" + +RETVAL="0" + +# Look for open ports, as the function name might imply +function findFreePorts() { + local isSet1="false" + local isSet2="false" + local isSet3="false" + local lower="8000" + randomPort1="0" + randomPort2="0" + randomPort3="0" + local -a listeners="( $( + netstat -ntl | \ + awk '/^tcp/ {gsub("(.)*:", "", $4); print $4}' + ) )" + while [ "$isSet1" = "false" ] || \ + [ "$isSet2" = "false" ] || \ + [ "$isSet3" = "false" ]; do + let port="${lower}+${RANDOM:0:4}" + if [ -z `expr " ${listeners[*]} " : ".*\( $port \).*"` ]; then + if [ "$isSet1" = "false" ]; then + export randomPort1="$port" + isSet1="true" + elif [ "$isSet2" = "false" ]; then + export randomPort2="$port" + isSet2="true" + elif [ "$isSet3" = "false" ]; then + export randomPort3="$port" + isSet3="true" + fi + fi + done +} + +function makeHomeDir() { + if [ ! -d "$CATALINA_HOME" ]; then + echo "$CATALINA_HOME does not exist, creating" + if [ ! -d "/usr/share/${NAME}" ]; then + mkdir /usr/share/${NAME} + cp -pLR /usr/share/aplaws/* /usr/share/${NAME} + fi + mkdir -p /var/log/${NAME} \ + /var/cache/${NAME} \ + /var/tmp/${NAME} + ln -fs /var/cache/${NAME} ${CATALINA_HOME}/work + ln -fs /var/tmp/${NAME} ${CATALINA_HOME}/temp + ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs + cp -pLR /usr/share/${NAME}/bin $CATALINA_HOME + cp -pLR /usr/share/${NAME}/conf $CATALINA_HOME + ln -fs /usr/share/java/aplaws ${CATALINA_HOME}/lib + ln -fs /usr/share/aplaws/webapps ${CATALINA_HOME}/webapps + chown ${TOMCAT_USER}:${TOMCAT_GROUP} /var/log/${NAME} + fi +} + +function parseOptions() { + options="" + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ + $TOMCAT_CFG + )" + if [ -r "/etc/sysconfig/${NAME}" ]; then + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; + print "export ", $0, ";" }' \ + /etc/sysconfig/${NAME} + )" + fi + TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}" +} + +# See how we were called. +function start() { + + echo -n "Starting ${TOMCAT_PROG}: " + if [ "$RETVAL" != "0" ]; then + log_failure_msg + return + fi + if [ -f "/var/lock/subsys/${NAME}" ]; then + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid +# if checkpid $kpid 2>&1; then + if [ -d "/proc/${kpid}" ]; then + log_success_msg + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi + RETVAL="0" + return + fi + fi + fi + # fix permissions on the log and pid files + export CATALINA_PID="/var/run/${NAME}.pid" + touch $CATALINA_PID 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_GROUP} $CATALINA_PID + fi + [ "$RETVAL" -eq "0" ] && touch $TOMCAT_LOG 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_GROUP} $TOMCAT_LOG + fi + if [ "$CATALINA_HOME" != "/usr/share/aplaws" -a "$RETVAL" -eq "0" ]; then + # Create an aplaws directory if it doesn't exist + makeHomeDir + # If CATALINA_HOME doesn't exist modify port number so that + # multiple instances don't interfere with each other + findFreePorts + sed -i -e "s/8015/${randomPort1}/g" -e "s/8090/${CONNECTOR_PORT}/g" \ + -e "s/8019/${randomPort2}/g" -e "s/8453/${randomPort3}/g" \ + ${CATALINA_HOME}/conf/server.xml + fi + parseOptions + if [ "$RETVAL" -eq "0" -a "$SECURITY_MANAGER" = "true" ]; then + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security ${TOMCAT_LOG}" \ + >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4" + else + + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start ${TOMCAT_LOG}" >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + log_success_msg + touch /var/lock/subsys/${NAME} + else + log_failure_msg "Error code ${RETVAL}" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function stop() { + echo -n "Stopping ${TOMCAT_PROG}: " + if [ -f "/var/lock/subsys/${NAME}" ]; then + parseOptions + if [ "$RETVAL" -eq "0" ]; then + touch /var/lock/subsys/${NAME} 2>&1 || RETVAL="4" + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop ${TOMCAT_LOG}" >> /var/log/${NAME}/initd.out 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + count="0" + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ + [ "$count" -gt "$SHUTDOWN_WAIT" ]; do + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + echo "waiting for processes $kpid to exit" + fi + sleep 1 + let count="${count}+1" + done + if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + log_warning_msg "killing processes which did not stop after ${SHUTDOWN_WAIT} seconds" + fi + kill -9 $kpid + fi + log_success_msg + fi + rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid + else + log_failure_msg + RETVAL="4" + fi + else + log_success_msg + RETVAL="0" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function status() +{ + checkpidfile + if [ "$RETVAL" -eq "0" ]; then + log_success_msg "${NAME} (pid ${kpid}) is running..." + elif [ "$RETVAL" -eq "1" ]; then + log_failure_msg "PID file exists, but process is not running" + else + checklockfile + if [ "$RETVAL" -eq "2" ]; then + log_failure_msg "${NAME} lockfile exists but process is not running" + else + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" + if [ -z "$pid" ]; then + log_success_msg "${NAME} is stopped" + RETVAL="3" + else + log_success_msg "${NAME} (pid $pid) is running..." + RETVAL="0" + fi + fi + fi +} + +function checklockfile() +{ + if [ -f /var/lock/subsys/${NAME} ]; then + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" +# The lockfile exists but the process is not running + if [ -z "$pid" ]; then + RETVAL="2" + fi + fi +} + +function checkpidfile() +{ + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + if [ -d "/proc/${kpid}" ]; then +# The pid file exists and the process is running + RETVAL="0" + else +# The pid file exists but the process is not running + RETVAL="1" + return + fi + fi +# pid file does not exist and program is not running + RETVAL="3" +} + +function usage() +{ + echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" + RETVAL="2" +} + +# See how we were called. +RETVAL="0" +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + reload) + RETVAL="3" + ;; + force-reload) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + status) + status + ;; + version) + ${TOMCAT_SCRIPT} version + ;; + *) + usage + ;; +esac + +exit $RETVAL diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.logrotate b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.logrotate new file mode 100644 index 000000000..4e5856b6d --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.logrotate @@ -0,0 +1,8 @@ +@@@TCLOG@@@/catalina.out { + copytruncate + weekly + rotate 52 + compress + missingok + create 0644 aplaws aplaws-admin +} diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.sysconfig b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.sysconfig new file mode 100644 index 000000000..33ed564b2 --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.sysconfig @@ -0,0 +1,63 @@ +# Service-wide configuration file for APLAWS+ service. +# This will be sourced by APLAWS+ init script after the system-wide configuration +# file /etc/aplaws/aplaws.conf, thus allowing values to be overridden in a +# per-service manner. +# +# NEVER change the init script itself. To change values for all services make +# your changes in /etc/aplaws/aplaws.conf! +# +# To change values for a specific service make your edits here. +# To create a new service create a link from /etc/init.d/ to +# /etc/init.d/aplaws (do not copy the init script) and make a copy of the +# /etc/sysconfig/aplaws file to /etc/sysconfig/ and change +# the property values so the two services won't conflict. Register the new +# service in the system as usual (see chkconfig and similars). +# +# +# ---------------------------------------------------------- +# Heavily borrowed (i.e. copied) from jpackage.org/Fedora +# Tomcat configuration file tomcat6-6.0.sysconfig. +# All honour granted to jpackage.org and its contributors. +# ---------------------------------------------------------- + +# Where your java installation lives +#JAVA_HOME="/usr/lib/jvm/jre" + +# Where your tomcat installation lives +#CATALINA_BASE="@@@TCHOME@@@" +#CATALINA_HOME="@@@TCHOME@@@" +#JASPER_HOME="@@@TCHOME@@@" +#CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xmx768m -Xms512m -XX:MaxPermSize=256m" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +#TOMCAT_USER="@@@TCUSER@@@" +#TOMCAT_GROUP="@@@TCUSER@@@-admin" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +#SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +#SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +#SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +#CATALINA_PID="/var/run/@@@TCPID@@@.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8090" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.wrapper b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.wrapper new file mode 100644 index 000000000..81288b16b --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SOURCE/scientificcms-2.0.wrapper @@ -0,0 +1,65 @@ +#!/bin/bash + +if [ -r /usr/share/java-utils/java-functions ]; then + . /usr/share/java-utils/java-functions +else + echo "Can't read Java functions library, aborting" + exit 1 +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +CLASSPATH="${CLASSPATH}:$(build-classpath commons-daemon 2>/dev/null)" + +if [ "$1" = "start" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "start-security" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.security.manager \ + -Djava.security.policy=="${CATALINA_BASE}/conf/catalina.policy" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "stop" ]; then + ${JAVACMD} $JAVA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap stop \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 +elif [ "$1" = "version" ]; then + ${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \ + org.apache.catalina.util.ServerInfo +else + echo "Usage: $0 {start|start-security|stop|version}" + exit 1 +fi diff --git a/tools-ng/distribution/scientificcms/rpm/SOURCE/tomcat6-6.0-server-xml.patch b/tools-ng/distribution/scientificcms/rpm/SOURCE/tomcat6-6.0-server-xml.patch new file mode 100644 index 000000000..76e52927a --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SOURCE/tomcat6-6.0-server-xml.patch @@ -0,0 +1,59 @@ +--- conf/server.xml.bak 2011-08-20 20:08:54.871251765 +0200 ++++ conf/server.xml 2011-08-20 20:17:57.623539167 +0200 +@@ -19,7 +19,7 @@ + define subcomponents such as "Valves" at this level. + Documentation at /docs/config/server.html + --> +- ++ + + + +@@ -64,30 +64,30 @@ + Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) + Java AJP Connector: /docs/config/ajp.html + APR (HTTP/AJP) Connector: /docs/apr.html +- Define a non-SSL HTTP/1.1 Connector on port 8080 ++ Define a non-SSL HTTP/1.1 Connector on port 8090 + --> +- ++ redirectPort="8453" /> + + +- + + +- +- ++ ++ + + + + + + ++ ++ ++ ++ ++ + diff --git a/tools-ng/distribution/scientificcms/rpm/SPEC/scientificcms.spec b/tools-ng/distribution/scientificcms/rpm/SPEC/scientificcms.spec new file mode 100644 index 000000000..716e85196 --- /dev/null +++ b/tools-ng/distribution/scientificcms/rpm/SPEC/scientificcms.spec @@ -0,0 +1,358 @@ +# Copyright (c) 2000-2009, JPackage Project +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution.// +# 3. Neither the name of the JPackage Project nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# APLAWS+ details +%global bundle std +%global major_version 2 +%global minor_version 0 +%global micro_version 0 +%global revision beta1.r1669 +%define dist .openccm + +%global apuid 291 +%global arch noarch + +# Servlet Container Details +%global sc_name tomcat6 +%global sc_major_version 6 +%global sc_minor_version 0 +%global sc_micro_version 32 +%global packdname apache-tomcat-%{sc_major_version}.%{sc_minor_version}.%{sc_micro_version} + +%global jspspec 2.1 +%global servletspec 2.5 + +# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ +%global homedir %{_datadir}/%{name} +# FHS: /var/lib dir: state saving data, no user configuration +# /srv dir: site-specific data served by the system, +# read-only data, writable data, scripts +# %global basedir %{_var}/lib/%{name} +%global basedir /srv/%{name} + +%global bindir %{homedir}/bin +%global libdir %{homedir}/lib +%global confdir %{_sysconfdir}/%{name} +%global logdir %{_var}/log/%{name} +%global cachedir %{_var}/cache/%{name} +%global tempdir %{cachedir}/temp +%global workdir %{cachedir}/work +%global webappdir %{basedir}/webapps +%global addondir %{basedir}/ccm-addons +%global initrddir %{_sysconfdir}/init.d + +%global ccmdir /ROOT + +# Avoid RPM 4.2+'s internal dep generator, it may produce bogus +# Provides/Requires here. +%define _use_internal_dependency_generator 0 + +# This prevents aggressive stripping. +%define debug_package %{nil} + +Name: scientificcms +Epoch: 0 +Version: %{major_version}.%{minor_version}.%{micro_version} +Release: %{bundle}.%{revision} +Summary: ScientificCMS Collaboration and Content Management System bundled with Tomcat6 servlet container. + +License: LGPL +URL: http://apalaws.org/ +# Tomcat stuff +Source0: apache-tomcat-%{sc_major_version}.%{sc_minor_version}.%{sc_micro_version}.tar.gz +Source1: %{name}-%{major_version}.%{minor_version}.conf +Source2: %{name}-%{major_version}.%{minor_version}.init +Source3: %{name}-%{major_version}.%{minor_version}.sysconfig +Source4: %{name}-%{major_version}.%{minor_version}.wrapper +Source5: %{name}-%{major_version}.%{minor_version}.logrotate +# Source6: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-digest.script +# Source7: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-tool-wrapper.script +# APLAWS+ stuff +Source8: %{name}-%{bundle}-%{major_version}-%{minor_version}-%{micro_version}-beta-1.war +Source9: postgresql-jdbc-8.4.701.jar +Source10: ojdbc14.jar +Source11: %{name}-%{bundle}-addon-%{major_version}-%{minor_version}-%{micro_version}-beta-1.zip + +Patch0: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-tomcat-users-webapp.patch +Patch1: %{sc_name}-%{sc_major_version}.%{sc_minor_version}-server-xml.patch + +BuildArch: noarch + + +# BuildRequires: ant +# BuildRequires: ant-nodeps +BuildRequires: findutils +# BuildRequires: java-1.6.0-devel +BuildRequires: jpackage-utils >= 0:1.7.0 + +Requires: java-1.6.0 +Requires: procps +Requires(pre): shadow-utils +Requires(pre): shadow-utils +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(post): redhat-lsb +Requires(preun): redhat-lsb +Requires(post): jpackage-utils +Requires(postun): jpackage-utils + + +%description +ScientificCMS is content and collaboration management web application. + +This package distributes ScientificCMS with the original, unmodified binary +Apache Tomcat distribution integrated in a FHS compliant structure and +includes configuration and helper files to start Tomcat during systems +init process. + +# -------------------------------------------------------------------------- + +%package addons +Summary: Provides additional packages not included in the ScientificCMS ${bundle} bundle. +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description addons +Provides additional packages not included in the APLAWS ${bundle} bundle. + +# -------------------------------------------------------------------------- + + + +%prep + +%setup -n %{packdname} -q +chmod -R go=u-w * +chmod -R u+w * + +# remove pre-built binaries and windows files +find . -type f \( \ + -name "*.bat" -o \ + -name "*.gz" -o \ + -name "*.war" -o \ + -name "*.zip" -o \ + -name "Thumbs.db" \) | xargs -t %{__rm} + +# excluded in order to provide the managers class files +# -name "*.class" -o \ + +%patch0 -p0 +%patch1 -p0 + +rm -rf webapps/docs +rm -rf webapps/examples +rm -rf webapps/ROOT/* +%{__cp} %{SOURCE9} lib/ +%{__cp} %{SOURCE10} lib/ + +# unpack ccm application +cd webapps/ROOT/ +unzip %{SOURCE8} +cd ../.. + +mkdir addons +cd addons/ +unzip %{SOURCE11} + + + +%build + +# Nope. + + +%install +rm -rf $RPM_BUILD_ROOT + +# build initial path structure +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{initrddir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir} +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir} +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}/Catalina/localhost +%{__install} -d -m 2755 ${RPM_BUILD_ROOT}%{webappdir} +%{__install} -d -m 2755 ${RPM_BUILD_ROOT}%{addondir} +%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir} +/bin/touch ${RPM_BUILD_ROOT}%{logdir}/catalina.out +%{__install} -d -m 2775 ${RPM_BUILD_ROOT}%{tempdir} +%{__install} -d -m 2775 ${RPM_BUILD_ROOT}%{workdir} + +# move things into place +# tomcat stuff first +# pushd %--{packdname} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/LICENSE ${RPM_BUILD_ROOT}/%{homedir}/ + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/NOTICE ${RPM_BUILD_ROOT}/%{homedir}/ + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/RELEASE* ${RPM_BUILD_ROOT}/%{homedir}/ + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/lib/*.jar ${RPM_BUILD_ROOT}%{libdir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/webapps/* ${RPM_BUILD_ROOT}%{webappdir} + %{__cp} -a $RPM_BUILD_DIR/%{packdname}/addons/* ${RPM_BUILD_ROOT}%{addondir} +# popd + + +# supporting files for configuration, init etc. +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" \ + -e "s|\@\@\@TCPID\@\@\@|%{name}|g" \ + -e "s|\@\@\@TCUSER\@\@\@|%{name}|g" %{SOURCE1} \ + > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf + +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" \ + -e "s|\@\@\@TCPID\@\@\@|%{name}|g" \ + -e "s|\@\@\@TCUSER\@\@\@|%{name}|g" %{SOURCE3} \ + > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} + +%{__install} -m 0644 %{SOURCE2} \ + ${RPM_BUILD_ROOT}%{initrddir}/%{name} + +%{__install} -m 0644 %{SOURCE4} \ + ${RPM_BUILD_ROOT}%{_sbindir}/%{name} +%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} + +%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \ + > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name} + +# %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ +# -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ +# -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \ +# > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest + +# %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ +# -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ +# -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \ +# > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper + +# symlink to the FHS locations where we've installed things +pushd ${RPM_BUILD_ROOT}%{homedir} + %{__ln_s} %{confdir} conf + %{__ln_s} %{logdir} logs + %{__ln_s} %{tempdir} temp + %{__ln_s} %{workdir} work + %{__ln_s} %{webappdir} webapps +popd + + + +%pre +# add the aplaws user and group +%{_sbindir}/groupadd -g %{apuid} -r aplaws-admin 2>/dev/null || : +%{_sbindir}/useradd -c "ScientificCMS" -u %{apuid} -g nobody -N \ + -s /bin/bash -r -d %{homedir} aplaws 2>/dev/null || : + + +%post +# install but don't activate +/sbin/chkconfig --add %{name} + + +%preun +# clean tempdir and workdir on removal or upgrade +%{__rm} -rf %{workdir} %{tempdir} +if [ "$1" = "0" ]; then + %{initrddir}/%{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi + +# base package +%files +%defattr(0664,root,root,0775) +# % % doc {LICENSE,NOTICE,RELEASE*} + +# attribute flags for rpm support and config files +# %attr(0755,root,root) %{_bindir}/%{name}-digest +# %attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper +%attr(0755,root,root) %{_sbindir}/d%{name} +%attr(0755,root,root) %{_sbindir}/%{name} +%attr(0755,root,root) %{initrddir}/%{name} +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} + +# attribute flags for basic tomcat directories and config files +%attr(2775,aplaws,aplaws-admin) %dir %{basedir} +%attr(7775,aplaws,aplaws-admin) %dir %{webappdir} +%attr(0775,aplaws,aplaws-admin) %dir %{cachedir} +%attr(0775,aplaws,aplaws-admin) %dir %{tempdir} +%attr(0775,aplaws,aplaws-admin) %dir %{workdir} +# (from sl spec) +%attr(0775,aplaws,aplaws-admin) %dir %{logdir} +%attr(0644,aplaws,aplaws-admin) %{logdir}/catalina.out + +%attr(0775,root,aplaws-admin) %dir %{confdir} +%attr(0775,root,aplaws-admin) %dir %{confdir}/Catalina +%attr(0775,root,aplaws-admin) %dir %{confdir}/Catalina/localhost +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/%{name}.conf +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/*.policy +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/*.properties +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/context.xml +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/server.xml +%attr(0664,aplaws,aplaws-admin) %config(noreplace) %{confdir}/tomcat-users.xml +%attr(0666,aplaws,aplaws-admin) %config(noreplace) %{confdir}/web.xml + +%dir %{homedir} +# specify files to include in package for installation +%defattr(0664,aplaws,aplaws-admin,0775) +%{homedir}/LICENSE +%{homedir}/NOTICE +%{homedir}/RELEASE* +%{homedir}/bin +%{homedir}/lib +%{homedir}/temp +%{homedir}/webapps +%{homedir}/work +%{homedir}/logs +%{homedir}/conf + +# %files admin-webapps +%defattr(0664,aplaws,aplaws-admin,0775) +%{webappdir}/host-manager +%{webappdir}/manager + +#%files webapps +%defattr(0664,aplaws,aplaws-admin,0775) +%{webappdir}/ROOT + +%files addons +%defattr(0664,aplaws,aplaws-admin,0775) +%{addondir} + + + +%changelog +* Thu May 17 2012 Peter Boy 0:2.0.0-1 +- Initial release, heavily borrowed from jpp, Scientific Linux, + and especially Fedora 16 diff --git a/tools-ng/tomcat/README b/tools-ng/distribution/tomcat/README similarity index 91% rename from tools-ng/tomcat/README rename to tools-ng/distribution/tomcat/README index b9265d0af..7dfa655fe 100644 --- a/tools-ng/tomcat/README +++ b/tools-ng/distribution/tomcat/README @@ -12,6 +12,6 @@ you may end up in the well known "dependency hell". This causes trouble in some circumstances. -The source rpm creates a sellf contained distribution which is just dependent +The source rpm creates a self contained distribution which is just dependent on a Java installation. diff --git a/tools-ng/tomcat/tomcat6-6.0.32-1ccm.TCbin.src.rpm b/tools-ng/distribution/tomcat/tomcat6-6.0.32-1ccm.TCbin.src.rpm similarity index 100% rename from tools-ng/tomcat/tomcat6-6.0.32-1ccm.TCbin.src.rpm rename to tools-ng/distribution/tomcat/tomcat6-6.0.32-1ccm.TCbin.src.rpm diff --git a/tools-ng/tomcat/tomcat6-6.0.33-1ccm.TCbin.src.rpm b/tools-ng/distribution/tomcat/tomcat6-6.0.33-1ccm.TCbin.src.rpm similarity index 100% rename from tools-ng/tomcat/tomcat6-6.0.33-1ccm.TCbin.src.rpm rename to tools-ng/distribution/tomcat/tomcat6-6.0.33-1ccm.TCbin.src.rpm diff --git a/tools-ng/user/placeholder.txt b/tools-ng/user/placeholder.txt deleted file mode 100644 index ca9e3688e..000000000 --- a/tools-ng/user/placeholder.txt +++ /dev/null @@ -1,3 +0,0 @@ -Tools fpr users to install and maintain CCM / APLAWS - -Comming soon (hopefully) \ No newline at end of file