[Lunar-commits] <moonbase> tomcat5-bin: Initial import
Stefan Wold
ratler at lunar-linux.org
Fri Feb 12 22:46:01 CET 2010
commit 34ef3e449e4e9aae39a78c1fda2ccccfd95cc770
Author: Stefan Wold <ratler at lunar-linux.org>
Date: Fri Feb 12 22:46:01 2010 +0100
tomcat5-bin: Initial import
---
java/tomcat5-bin/BUILD | 23 ++++++
java/tomcat5-bin/DEPENDS | 2 +
java/tomcat5-bin/DETAILS | 13 +++
java/tomcat5-bin/POST_INSTALL | 3 +
java/tomcat5-bin/tomcat5-install-instance | 118 +++++++++++++++++++++++++++++
5 files changed, 159 insertions(+), 0 deletions(-)
diff --git a/java/tomcat5-bin/BUILD b/java/tomcat5-bin/BUILD
new file mode 100644
index 0000000..e4ce02d
--- /dev/null
+++ b/java/tomcat5-bin/BUILD
@@ -0,0 +1,23 @@
+(
+ TARGET=/usr/share/tomcat5/
+
+ # Cleaning up
+ rm -rf bin/*.exe bin/*.bat bin/*.tar.gz bin/jsvc-src &&
+
+ prepare_install &&
+
+ mkdir -p ${TARGET}/skel/ &&
+ for i in bin common server shared; do
+ cp -r $i ${TARGET}/
+ done &&
+ for i in conf logs temp work webapps; do
+ cp -r $i ${TARGET}/skel/
+ done &&
+ mkdir -p ${TARGET}/skel/bin &&
+ chmod 0644 ${TARGET}/skel/conf/{*.xml,*.policy,*.properties,Catalina/localhost/*.xml} &&
+ chmod 755 ${TARGET}/skel/{work,temp,webapps,logs,conf} &&
+ install -m0755 ${SCRIPT_DIRECTORY}/tomcat5-install-instance /usr/bin/ &&
+
+ gather_docs LICENSE RUNNING.txt RELEASE-NOTES NOTICE
+
+) > $C_FIFO 2>&1
diff --git a/java/tomcat5-bin/DEPENDS b/java/tomcat5-bin/DEPENDS
new file mode 100644
index 0000000..8d337a3
--- /dev/null
+++ b/java/tomcat5-bin/DEPENDS
@@ -0,0 +1,2 @@
+depends %JAVA_SDK
+depends netcat
diff --git a/java/tomcat5-bin/DETAILS b/java/tomcat5-bin/DETAILS
new file mode 100644
index 0000000..70d96a2
--- /dev/null
+++ b/java/tomcat5-bin/DETAILS
@@ -0,0 +1,13 @@
+ MODULE=tomcat5-bin
+ VERSION=5.5.28
+ SOURCE=apache-tomcat-${VERSION}.tar.gz
+ SOURCE_URL=ftp://ftp.sunet.se/pub/www/servers/apache/dist/tomcat/tomcat-5/v${VERSION}/bin/
+SOURCE_DIRECTORY=$BUILD_DIRECTORY/apache-tomcat-$VERSION
+ SOURCE_VFY=sha256:6bbf7d15574fecc8ed75bf661d525596e86aec13a38ead5ed0ff2930c7b7f769
+ WEB_SITE="http://tomcat.apache.org/"
+ ENTERED=20100212
+ UPDATED=20100212
+ SHORT="Servlet container for Java Servlet and JavaServer Pages"
+cat <<EOF
+Tomcat 5.5.x Servlet container for Java Servlet and JavaServer Pages
+EOF
diff --git a/java/tomcat5-bin/POST_INSTALL b/java/tomcat5-bin/POST_INSTALL
new file mode 100644
index 0000000..5d6e2a8
--- /dev/null
+++ b/java/tomcat5-bin/POST_INSTALL
@@ -0,0 +1,3 @@
+
+message "Tomcat 5 is now installed. To setup a tomcat 5 instance"
+message "run the script /usr/bin/tomcat5-install-instance."
diff --git a/java/tomcat5-bin/tomcat5-install-instance b/java/tomcat5-bin/tomcat5-install-instance
new file mode 100755
index 0000000..398f512
--- /dev/null
+++ b/java/tomcat5-bin/tomcat5-install-instance
@@ -0,0 +1,118 @@
+#!/bin/bash
+
+PROGRAM=$(basename $0)
+
+usage() {
+cat <<EOF
+Usage: $PROGRAM [options] <directory>
+ directory: Name of the directory to create for the tomcat instance
+
+Options:
+ -h Display this help message
+ -p HTTP port for tomcat instance to listen on, default 8080.
+ -c Server shutdown control port to listen on, default 8005.
+ -a AJP port to listen on, default 8009.
+EOF
+}
+
+main() {
+ TPORT=${TPORT:-8080}
+ CPORT=${CPORT:-8005}
+ APORT=${APORT:-8009}
+
+
+ if [ "$TPORT" == "$CPORT" ] || [ "$CPORT" == "$APORT" ] || [ "$TPORT" == "$APORT" ]; then
+ echo "Error: Port numbers must be different for each listener"
+ exit 1
+ fi
+
+ check_port $TPORT "HTTP"
+ check_port $CPORT "Server control"
+ check_port $APORT "AJP connector"
+
+ targetdir=$1
+
+ mkdir -p ${targetdir}
+ FTARGET=$(cd ${targetdir}; pwd)
+ cp -r /usr/share/tomcat5/skel/* ${FTARGET}/
+
+ sed -i -e "s:Connector port=\"8080\":Connector port=\"${TPORT}\":; \
+ s:Server port=\"8005\" shutdown=\"SHUTDOWN\":Server port=\"${CPORT}\" shutdown=\"SHUTDOWN\":; \
+ s:Connector port=\"8009\":Connector port=\"${APORT}\":" ${FTARGET}/conf/server.xml
+
+ cat > ${FTARGET}/bin/startup.sh <<EOF
+#!/bin/bash
+export CATALINA_BASE=${FTARGET}
+/usr/share/tomcat5/bin/startup.sh
+EOF
+
+ cat > ${FTARGET}/bin/shutdown.sh <<EOF
+#!/bin/bash
+export CATALINA_BASE=${FTARGET}
+/usr/share/tomcat5/bin/shutdown.sh
+EOF
+
+chmod 755 ${FTARGET}/bin/{startup,shutdown}.sh
+
+ cat <<EOF
+* New Tomcat6 instance installed in ${FTARGET}
+* Run ${FTARGET}/bin/startup.sh to start your Tomcat6 instance
+EOF
+}
+
+check_port() {
+ port=$1
+ msg=$2
+
+ if nc localhost $port -z; then
+ echo "Error: Port already in use for: $msg $port"
+ exit 1
+ fi
+
+ if echo $port | egrep -q '^[0-9]+$'; then
+ if [ $port -gt 65535 ] || [ $port -lt 1024 ]; then
+ echo "Error: $msg port should be a number between 1024 - 65535"
+ exit 1
+ fi
+ else
+ echo "Error: $msg port should be a number!"
+ exit 1
+ fi
+}
+
+
+GETOPT_ARGS=$(getopt -n $PROGRAM -o "hp:c:a:" -- "$@")
+
+if [ $? -ne 0 ]; then
+ usage
+ exit
+else
+ eval set -- $GETOPT_ARGS
+
+ while true; do
+ case "$1" in
+ -h)
+ usage
+ exit
+ ;;
+ -p) export TPORT=$2; shift 2;;
+ -c) export CPORT=$2; shift 2;;
+ -a) export APORT=$2; shift 2;;
+ --) shift; break;;
+ *) usage; break;;
+ esac
+ done
+
+ if [ -z "$1" ]; then
+ echo "Error: Missing argument <directory>"
+ usage
+ exit 1
+ fi
+
+ if [ -d $1 ]; then
+ echo "Error: Target directory already exists."
+ exit 1
+ fi
+
+ main $@
+fi
More information about the Lunar-commits
mailing list