diff options
author | Ernst de Haan <znerd@FreeBSD.org> | 2002-02-19 08:20:39 +0000 |
---|---|---|
committer | Ernst de Haan <znerd@FreeBSD.org> | 2002-02-19 08:20:39 +0000 |
commit | 5416e71b191a05ec09d024063c88e8d0afee5954 (patch) | |
tree | 78c3ae0cb83df4de19f29b01d5539872705c371e /www/jakarta-tomcat41 | |
parent | Allow to configure HARD_SERVER_LIMIT via 'make' variable (diff) |
APP_TITLE was set twice.
Reported by: Kimura Fuyuki <fuyuki@mj.0038.net>
Notes
Notes:
svn path=/head/; revision=54886
Diffstat (limited to 'www/jakarta-tomcat41')
-rw-r--r-- | www/jakarta-tomcat41/Makefile | 26 | ||||
-rw-r--r-- | www/jakarta-tomcat41/files/tomcatctl | 143 | ||||
-rw-r--r-- | www/jakarta-tomcat41/pkg-plist | 1 |
3 files changed, 112 insertions, 58 deletions
diff --git a/www/jakarta-tomcat41/Makefile b/www/jakarta-tomcat41/Makefile index 5fdafed0e9ac..a38b03db0463 100644 --- a/www/jakarta-tomcat41/Makefile +++ b/www/jakarta-tomcat41/Makefile @@ -7,7 +7,7 @@ PORTNAME= jakarta-tomcat PORTVERSION= 3.2.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www java MASTER_SITES= http://www.apache.org/dist/jakarta/jakarta-tomcat/release/v${PORTVERSION}/bin/ \ http://www.metaverse.nl/~ernst/ \ @@ -30,8 +30,7 @@ APP_SHORTNAME= tomcat APPCTL_NAME= ${APP_SHORTNAME}ctl CTL_SCRIPT= ${PREFIX}/bin/${APPCTL_NAME} STARTUP_ORDER?= 020 -RC_SCRIPT= ${PREFIX}/etc/rc.d/${STARTUP_ORDER}.${PORTNAME}.sh -APP_TITLE= Jakarta Tomcat +STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/${STARTUP_ORDER}.${PORTNAME}.sh JAVA_HOME?= ${LOCALBASE}/jdk1.3.1 JAVA_PORT?= ${PORTSDIR}/java/jdk13 USER_NAME?= ${APP_SHORTNAME} @@ -42,13 +41,13 @@ PW?= /usr/sbin/pw LISTEN_PORT?= 8080 STDOUT_LOG?= ${LOG_DIR}/stdout.log STDERR_LOG?= ${LOG_DIR}/stderr.log -AUTO_START?= YES +AUTO_START?= NO pre-install: @${ECHO_CMD} "Installation settings:" @${ECHO_CMD} " Destination directory: ${APP_HOME}" @${ECHO_CMD} " Control script location: ${CTL_SCRIPT}" - @${ECHO_CMD} " Startup script location: ${RC_SCRIPT}" + @${ECHO_CMD} " Startup script location: ${STARTUP_SCRIPT}" @${ECHO_CMD} " Location of JDK: ${JAVA_HOME}" @${ECHO_CMD} " Location of Java port: ${JAVA_PORT}" @${ECHO_CMD} " Running as (user/group): ${USER_NAME}/${GROUP_NAME} (${USER_ID}:${GROUP_ID})" @@ -86,20 +85,23 @@ do-install: | ${SED} "/%%APP_SHORTNAME%%/s//${APP_SHORTNAME}/" \ | ${SED} "/%%APP_HOME%%/s//${APP_HOME:S/\//\\\//g}/" \ | ${SED} "/%%LOG_DIR%%/s//${LOG_DIR:S/\//\\\//g}/" \ - | ${SED} "/%%RC_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \ + | ${SED} "/%%STARTUP_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \ | ${SED} "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/" \ | ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \ | ${SED} "/%%STDOUT_LOG%%/s//${STDOUT_LOG:S/\//\\\//g}/" \ | ${SED} "/%%STDERR_LOG%%/s//${STDERR_LOG:S/\//\\\//g}/" \ > ${CTL_SCRIPT} - ${CHMOD} 755 ${CTL_SCRIPT} + ${CHOWN} ${USER_NAME}:${GROUP_NAME} ${CTL_SCRIPT} + ${CHMOD} 6554 ${CTL_SCRIPT} @# Install the startup script - ${LN} -sf ${CTL_SCRIPT} ${RC_SCRIPT} + ${CP} ${FILESDIR}/${PORTNAME}.sh ${STARTUP_SCRIPT} + ${CHMOD} 0554 ${STARTUP_SCRIPT} - @# Create the directories that the application will create it at the + @# Create the directories that the application will create at the @# first run - ${MKDIR} ${APP_HOME}/logs + ${MKDIR} ${LOG_DIR} + ${CHMOD} 6775 ${LOG_DIR} @# Install the server.xml file after processing it ${CAT} ${WRKSRC}/conf/server.xml \ @@ -110,6 +112,9 @@ do-install: @# Change ownership for the files ${CHOWN} -R ${USER_NAME}:${GROUP_NAME} ${APP_HOME} + @# Change the execute permissions for all shell scripts + ${CHMOD} 0554 ${APP_HOME}/bin/* + @# Install the man page .if !defined(NOPORTDOCS) ${CAT} ${FILESDIR}/${APPCTL_NAME}.1 \ @@ -120,6 +125,7 @@ do-install: post-install: @${ECHO_CMD} "${APP_TITLE} ${PORTVERSION} has been installed in ${APP_HOME}." + @${ECHO_CMD} "If you would like a user to be able to use ${APPCTL_NAME}, then put this user in the group ${GROUP_NAME}." .if !defined(NOPORTDOCS) @${ECHO_CMD} "Use 'man ${APPCTL_NAME}' for information about starting and stopping ${APP_TITLE}." .endif diff --git a/www/jakarta-tomcat41/files/tomcatctl b/www/jakarta-tomcat41/files/tomcatctl index 5ba640f927ad..3dddb5771e2e 100644 --- a/www/jakarta-tomcat41/files/tomcatctl +++ b/www/jakarta-tomcat41/files/tomcatctl @@ -3,7 +3,6 @@ # Set some variables VERSION=%%PORTVERSION%% APP_HOME=%%APP_HOME%% -USER_NAME=%%USER_NAME%% STDOUT_LOG=%%STDOUT_LOG%% STDERR_LOG=%%STDERR_LOG%% JAR_FILE=${APP_HOME}/lib/webserver.jar @@ -22,13 +21,6 @@ if [ -f ${JAVA_HOME}/lib/tools.jar ] ; then CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar fi -# Check if we're being run as a shell script or as an rc script -if [ ${MYSELF} = "%%RC_SCRIPT_NAME%%" ]; then - AS_RC_SCRIPT=yes -else - AS_RC_SCRIPT=no -fi - # Check if the JAVA_HOME directory is defined, otherwise set it to the # fallback default if [ "${JAVA_HOME}a" = "a" ]; then @@ -36,64 +28,119 @@ if [ "${JAVA_HOME}a" = "a" ]; then fi JAVA_CMD=${JAVA_HOME}/bin/java -# Function that starts the application -start() { + +############################################################################## +# Function that shows an error message +# +# This function is called by the 'checks' function +# +# Parameters: +# 1: The message to be displayed. + +error() { + echo -n "%%APP_SHORTNAME%%: ERROR: " + echo $1 +} + + +############################################################################## +# Function that performs all checks necessary for starting or stopping the +# application. +# +# This function is called by the 'start' and 'stop' functions +# +# This function expects no parameters + +checks() { # Make sure the application directory does exist if [ ! -d ${APP_HOME} ]; then - if [ "${AS_RC_SCRIPT}" = "yes" ]; then - echo "" - fi - echo "%%APP_SHORTNAME%%: ERROR: Unable to find %%APP_TITLE%% home directory at ${APP_HOME}." + error "Unable to find %%APP_TITLE%% home directory at ${APP_HOME}." exit 2 fi # Make sure the application JAR file exists if [ ! -r ${JAR_FILE} ]; then - if [ "${AS_RC_SCRIPT}" = "yes" ]; then - echo "" - fi - echo "%%APP_SHORTNAME%%: ERROR: Unable to find %%APP_TITLE%% JAR file at ${JAR_FILE}." + error "Unable to find %%APP_TITLE%% JAR file at ${JAR_FILE}." exit 3 fi # Make sure the Java VM can be found if [ ! -x ${JAVA_CMD} ]; then - if [ "${AS_RC_SCRIPT}" = "yes" ]; then - echo "" - fi - echo "%%APP_SHORTNAME%%: ERROR: Unable to find Java VM at ${JAVA_HOME}." + error "Unable to find Java VM at ${JAVA_HOME}." exit 4 fi +} - if [ "${AS_RC_SCRIPT}" = "yes" ]; then - echo -n " %%APP_SHORTNAME%%" - fi - su - ${USER_NAME} -c "(cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat) >> ${STDOUT_LOG} 2>> ${STDERR_LOG}" + +############################################################################## +# Functions that calls the application with the specified parameter +# +# Parameters: +# 1: The argument to pass to the application (optional) + +app() { + (cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat $1) >> ${STDOUT_LOG} 2>> ${STDERR_LOG} +} + + +############################################################################## +# Function that starts the application +# +# This function is called from the main function +# +# This function expects no parameters + +start() { + # Perform the checks + checks + + # Stop the application + app } + +############################################################################## # Function that stops the application +# +# This function is called from the main function +# +# This function expects no parameters + stop() { - if [ "${AS_RC_SCRIPT}" = "yes" ]; then - echo -n " %%APP_SHORTNAME%%" - fi - su - ${USER_NAME} -c "(cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat -stop) >> ${STDOUT_LOG} 2>> ${STDERR_LOG}" + # Perform the checks + checks + + # Stop the application + app -stop } -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "" - echo "Usage: ${MYSELF} { start | stop | restart }" - echo "" - exit 64 - ;; -esac + +############################################################################## +# Main function. This function calls the 'start' and 'stop' functions. +# +# Parameters: +# 1: The argument to this shell script + +main() { + case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: ${MYSELF} { start | stop | restart }" + exit 64 + ;; + esac +} + + +# Call the main function and exit +main $1 +exit 0 diff --git a/www/jakarta-tomcat41/pkg-plist b/www/jakarta-tomcat41/pkg-plist index 11e2cdeb4b7e..955f4bf18b2a 100644 --- a/www/jakarta-tomcat41/pkg-plist +++ b/www/jakarta-tomcat41/pkg-plist @@ -1,3 +1,4 @@ +bin/tomcatctl etc/rc.d/020.jakarta-tomcat.sh %%T%%/KEYS %%T%%/LICENSE |