aboutsummaryrefslogtreecommitdiff
path: root/mail/james/files
diff options
context:
space:
mode:
authorJason Unovitch <junovitch@FreeBSD.org>2015-10-04 21:26:09 +0000
committerJason Unovitch <junovitch@FreeBSD.org>2015-10-04 21:26:09 +0000
commit3647465a252585f7ea78f10d1ace0b88645f70b2 (patch)
tree2d26f396bc3c8c470ecd5f6607f322446138d5f8 /mail/james/files
parentb12ccea60504710f2e3fc45de7d0d9d0b39e2908 (diff)
downloadports-3647465a252585f7ea78f10d1ace0b88645f70b2.tar.gz
ports-3647465a252585f7ea78f10d1ace0b88645f70b2.zip
mail/james: security update 2.3.1 -> 2.3.2.1; while here fix all the things
- Add LICENSE and LICENSE_FILE - Add NO_ARCH - Fix PID_FILE using an undefined variable (resulting PID was /var/run/.pid) - Fix .include lines post staging support - Actually use the version number from PLIST_SUB in pkg-plist - Overhaul rc script - Add PROVIDE/REQUIRE/KEYWORD to header - Remove "geronimo" references from when the port was originally copied - Remove %%JAMES_VERSION%% in rc variable names. Every port version bump in the past came with a POLA issue as james231_enable=YES would now have to be james2321_enable=YES. Provide a shim to translate the old variable names and provide a warning to update rc.conf syntax. - Match start routine to embedded start-up script (which enables stop command to work without a java.lang.IllegalThreadStateException) - Add working status routine - Standardize indentation PR: 203461 Security: CVE-2015-7611 Security: be3069c9-67e7-11e5-9909-002590263bf5 MFH: 2015Q4
Notes
Notes: svn path=/head/; revision=398623
Diffstat (limited to 'mail/james/files')
-rw-r--r--mail/james/files/james.in168
1 files changed, 94 insertions, 74 deletions
diff --git a/mail/james/files/james.in b/mail/james/files/james.in
index 838ae5f61443..75b52265471a 100644
--- a/mail/james/files/james.in
+++ b/mail/james/files/james.in
@@ -2,95 +2,100 @@
#
# $FreeBSD$
#
-
+# PROVIDE: james
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
#
-# Configuration settings for geronimo%%GERONIMO_VERSION%% in /etc/rc.conf:
+# Configuration settings for james in /etc/rc.conf:
#
-# james%%JAMES_VERSION%%_enable (bool):
+# james_enable (bool):
# Set to "NO" by default.
-# Set it to "YES" to enable james%%JAMES_VERSION%%
-#
+# Set it to "YES" to enable james
#
-# james%%JAMES_VERSION%%_home (str)
+# james_home (str)
# Set to "%%JAMES_HOME%%" by default.
# Set the JAMES_HOME variable for the James process
#
-# james%%JAMES_VERSION%%_base (str)
+# james_base (str)
# Set to "%%JAMES_HOME%%" by default.
# Set the JAMES_BASE variable for the James process
#
-# james%%JAMES_VERSION%%_tmpdir (str)
+# james_tmpdir (str)
# Set to "/tmp" by default.
#
-# geronimo%%GERONIMO_VERSION%%_stop_timeout (num)
+# james_stop_timeout (num)
# Set to "10" by default.
-# Sets the timeout in seconds to allow geronimo to shutdown.
-# After the timeout has elapsed, geronimo will be killed.
+# Sets the timeout in seconds to allow james to shutdown.
+# After the timeout has elapsed, james will be killed.
#
-# james%%JAMES_VERSION%%_java_home (str):
-# james%%JAMES_VERSION%%_java_vendor (str):
-# james%%JAMES_VERSION%%_java_version (str):
-# james%%JAMES_VERSION%%_java_os (str):
+# james_java_home (str):
+# james_java_vendor (str):
+# james_java_version (str):
+# james_java_os (str):
# Specify the requirements of the Java VM to use. See javavm(1).
#
-# james%%JAMES_VERSION%%_classpath (str):
+# james_classpath (str):
# Set to "" by default.
# Addtional classes to add to the CLASSPATH
#
-# james%%JAMES_VERSION%%_java_opts (str):
+# james_java_opts (str):
# Set to "" by default.
# Java VM args to use.
#
-james%%JAMES_VERSION%%_enable="${james%%JAMES_VERSION%%_enable:-"NO"}"
-james%%JAMES_VERSION%%_java_version="${james%%JAMES_VERSION%%_java_version:-"%%JAVA_VERSION%%"}"
-james%%JAMES_VERSION%%_home="${james%%JAMES_VERSION%%_home:-"%%JAMES_HOME%%"}"
-james%%JAMES_VERSION%%_base="${james%%JAMES_VERSION%%_base:-"%%JAMES_HOME%%"}"
-james%%JAMES_VERSION%%_tmpdir="${james%%JAMES_VERSION%%_tmpdir:-"/tmp"}"
-james%%JAMES_VERSION%%_stop_timeout="${james%%JAMES_VERSION%%_stop_timeout:-"10"}"
+james_enable="${james_enable:-"NO"}"
+james_java_version="${james_java_version:-"%%JAVA_VERSION%%"}"
+james_home="${james_home:-"%%JAMES_HOME%%"}"
+james_base="${james_base:-"%%JAMES_HOME%%"}"
+james_tmpdir="${james_tmpdir:-"/tmp"}"
+james_stop_timeout="${james_stop_timeout:-"10"}"
. /etc/rc.subr
-name="james%%JAMES_VERSION%%"
-rcvar=james%%JAMES_VERSION%%_enable
+name=james
+rcvar=james_enable
pidfile="%%PID_FILE%%"
-JAVA_HOME=%%JAVA_HOME%%
-JRE_HOME=$JAVA_HOME/jre
+load_rc_config "${name}"
-JVM_EXT_DIRS="${james%%JAMES_VERSION%%_home}/lib:${james%%JAMES_VERSION%%_home}/tools/lib"
-JVM_OPTS="-Djava.ext.dirs=$JVM_EXT_DIRS"
+for var in $(list_vars "james[0-9]*"); do
+ echo "WARNING: \$$var is deprecated, use \$james_${var#*_} instead."
+ eval james_${var#*_}=\"\$$var\"
+done
-load_rc_config "${name}"
+JAVA_HOME="%%JAVA_HOME%%"
+JRE_HOME="$JAVA_HOME/jre"
+JVM_EXT_DIRS="${james_home}/lib:${james_home}/tools/lib"
+JVM_OPTS="-Djava.ext.dirs=$JVM_EXT_DIRS"
-if [ -n "${james%%JAMES_VERSION%%_java_home}" ] ; then
- export JAVA_HOME="${james%%JAMES_VERSION%%_java_home}"
+if [ -n "${james_java_home}" ] ; then
+ export JAVA_HOME="${james_java_home}"
fi
-if [ -n "${james%%JAMES_VERSION%%_java_version}" ] ; then
- export JAVA_VERSION="${james%%JAMES_VERSION%%_java_version}"
+if [ -n "${james_java_version}" ] ; then
+ export JAVA_VERSION="${james_java_version}"
fi
-if [ -n "${james%%JAMES_VERSION%%_java_vendor}" ] ; then
- export JAVA_VENDOR="${james%%JAMES_VERSION%%_java_vendor}"
+if [ -n "${james_java_vendor}" ] ; then
+ export JAVA_VENDOR="${james_java_vendor}"
fi
-if [ -n "${james%%JAMES_VERSION%%_java_os}" ] ; then
- export JAVA_OS="${james%%JAMES_VERSION%%_java_os}"
+if [ -n "${james_java_os}" ] ; then
+ export JAVA_OS="${james_java_os}"
fi
if [ "$JAVA_HOME" = "" ] ; then
- echo "ERROR: JAVA_HOME not found in your environment."
- echo
- echo "Please, set the JAVA_HOME variable in your environment to match the"
- echo "location of the Java Virtual Machine you want to use."
- exit 1
+ echo "ERROR: JAVA_HOME not found in your environment."
+ echo
+ echo "Please, set the JAVA_HOME variable in your environment to match the"
+ echo "location of the Java Virtual Machine you want to use."
+ return 1
fi
-if [ -z "${james%%JAMES_VERSION%%_tmpdir}" ] ; then
- # Define the java.io.tmpdir to use for Phoenix
- james%%JAMES_VERSION%%_tmpdir="${james%%JAMES_VERSION%%_home}"/temp
- mkdir -p "${james%%JAMES_VERSION%%_tmpdir}"
+if [ -z "${james_tmpdir}" ] ; then
+ # Define the java.io.tmpdir to use for Phoenix
+ james_tmpdir="${james_home}"/temp
+ mkdir -p "${james_tmpdir}"
fi
java_cmd=
@@ -102,43 +107,58 @@ fi
java_command="$java_cmd $JVM_OPTS \
- -Djava.security.policy=jar:file:${james%%JAMES_VERSION%%_home}/bin/phoenix-loader.jar!/META-INF/java.policy \
- -Dphoenix.home=${james%%JAMES_VERSION%%_home} \
- -Djava.io.tmpdir=${james%%JAMES_VERSION%%_tmpdir} \
- -jar ${james%%JAMES_VERSION%%_home}/bin/phoenix-loader.jar >/dev/null"
+ -Djava.security.policy=jar:file:${james_home}/bin/phoenix-loader.jar!/META-INF/java.policy \
+ -Dphoenix.home=${james_home} \
+ -Djava.io.tmpdir=${james_tmpdir} \
+ -jar ${james_home}/bin/phoenix-loader.jar >/dev/null"
PHOENIX_CONSOLE="$PHOENIX_TMPDIR/phoenix.console"
-if [ -z "$PHOENIX_CONSOLE" ]
-then
- if [ -w /dev/console ]
- then
- PHOENIX_CONSOLE=/dev/console
- else
- PHOENIX_CONSOLE=/dev/tty
- fi
+if [ -z "$PHOENIX_CONSOLE" ] ; then
+ if [ -w /dev/console ]; then
+ PHOENIX_CONSOLE=/dev/console
+ else
+ PHOENIX_CONSOLE=/dev/tty
+ fi
fi
-
# Subvert the check_pid_file procname check.
-if [ -f $pidfile ]; then
- read rc_pid junk < $pidfile
- if [ ! -z "$rc_pid" ]; then
- procname=`ps -o ucomm= $rc_pid`
- fi
+if [ -f $pidfile ] ; then
+ read rc_pid junk < $pidfile
+ if [ ! -z "$rc_pid" ]; then
+ procname=`ps -o ucomm= $rc_pid`
+ fi
fi
-command="/usr/sbin/daemon"
-flags="-p ${pidfile} ${java_command}"
+start_cmd=james_start
+status_cmd=james_status
+stop_cmd=james_stop
+
+james_start() {
+ rc_pid=$(check_pidfile $pidfile *$procname*)
+
+ if [ ! -z "$rc_pid" ]; then
+ echo "Already running!"
+ return 1
+ fi
+
+ echo "Starting ${name}."
+ nohup sh -c "exec $java_command >>$PHOENIX_CONSOLE 2>&1" >/dev/null &
+ echo $! > $pidfile
+}
-start_precmd=pid_touch
-stop_cmd="james%%JAMES_VERSION%%_stop"
+james_status() {
+ rc_pid=$(check_pidfile $pidfile *$procname*)
-pid_touch ()
-{
- touch $pidfile
+ if [ -z "$rc_pid" ]; then
+ echo "${name} not running"
+ return 1
+ else
+ echo "${name} is running as pid $rc_pid"
+ return 0
+ fi
}
-james%%JAMES_VERSION%%_stop() {
+james_stop() {
rc_pid=$(check_pidfile $pidfile *$procname*)
if [ -z "$rc_pid" ]; then
@@ -153,7 +173,7 @@ james%%JAMES_VERSION%%_stop() {
echo "Stopping ${name}."
kill ${rc_pid}>/dev/null
- james_wait_max_for_pid ${james%%JAMES_VERSION%%_stop_timeout} ${rc_pid}
+ james_wait_max_for_pid ${james_stop_timeout} ${rc_pid}
kill -KILL ${rc_pid} 2> /dev/null && echo "Killed."
echo -n > ${pidfile}
}