Revamp that port:

* don't use an /etc/default/activemq config file; it's too generic and
linuxish -- we'll use /etc/activemqrc
* no need to install the wrappers since we have rc scripts
* properly sample *all* configuration files
* run as unpriviledged user: _activemq by default
* remove useless README
* properly remove data files at @extraunexec time
* proper rc_stop in the rc script
* take MAINTAINER

ok jasper@ on a previous submission
This commit is contained in:
ajacoutot 2013-03-13 16:30:11 +00:00
parent f11cc4f03e
commit 39b5277db9
7 changed files with 128 additions and 87 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2013/03/11 11:35:45 espie Exp $
# $OpenBSD: Makefile,v 1.5 2013/03/13 16:30:11 ajacoutot Exp $
PKG_ARCH= *
@ -6,10 +6,12 @@ COMMENT= open source message broker implementing JMS 1.1
V= 5.8.0
DISTNAME= apache-activemq-$V
REVISION= 0
REVISION= 1
CATEGORIES= net
MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>
# Apache2
PERMIT_PACKAGE_CDROM= Yes
@ -29,12 +31,9 @@ NO_TEST= Yes
do-install:
rm -r ${WRKSRC}/bin/macosx/ ${WRKSRC}/bin/linux-x86-* ${WRKSRC}/bin/*.orig
${INSTALL_DATA_DIR} ${PREFIX}/activemq/
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/activemq/conf
cd ${WRKSRC} && tar cf - * | tar xf - -C ${PREFIX}/activemq/
.for s in activemq activemq-admin
${SUBST_CMD} -o ${BINOWN} -g ${BINGRP} -c ${FILESDIR}/$s \
${PREFIX}/bin/$s
chmod +x ${PREFIX}/bin/$s
.endfor
${INSTALL_DATA} ${FILESDIR}/activemqrc ${PREFIX}/activemq/conf/
${INSTALL_DATA} ${FILESDIR}/activemqrc ${PREFIX}/share/examples/activemq/
mv ${PREFIX}/activemq/conf ${PREFIX}/share/examples/activemq/
.include <bsd.port.mk>

View File

@ -1,5 +0,0 @@
#!/bin/sh
#
# $OpenBSD: activemq,v 1.1.1.1 2013/02/05 15:08:45 jasper Exp $
exec ${TRUEPREFIX}/activemq/bin/activemq "$@"

View File

@ -1,5 +0,0 @@
#!/bin/sh
#
# $OpenBSD: activemq-admin,v 1.1.1.1 2013/02/05 15:08:45 jasper Exp $
exec ${TRUPREFIX}/activemq/bin/activemq-admin "$@"

View File

@ -1,19 +1,42 @@
$OpenBSD: patch-bin_activemq,v 1.1.1.1 2013/02/05 15:08:45 jasper Exp $
Don't reserve more memory upfront than the default limits allow.
--- bin/activemq.orig Tue Oct 2 18:15:33 2012
+++ bin/activemq Tue Feb 5 08:43:45 2013
@@ -151,9 +151,9 @@ fi
JAVACMD="auto"
$OpenBSD: patch-bin_activemq,v 1.2 2013/03/13 16:30:11 ajacoutot Exp $
--- bin/activemq.orig Wed Feb 6 17:53:14 2013
+++ bin/activemq Wed Mar 13 16:03:24 2013
@@ -29,7 +29,7 @@
# Set jvm memory configuration
-if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
- ACTIVEMQ_OPTS_MEMORY="-Xms1G -Xmx1G"
-fi
+#if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
+# ACTIVEMQ_OPTS_MEMORY="-Xms1G -Xmx1G"
+#fi
# ------------------------------------------------------------------------
# CONFIGURATION
-ACTIVEMQ_CONFIGS="/etc/default/activemq $HOME/.activemqrc"
+ACTIVEMQ_CONFIGS="/etc/activemqrc $HOME/.activemqrc"
# Uncomment to enable audit logging
#ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.audit=true"
# Backup invocation parameters
COMMANDLINE_ARGS="$@"
@@ -37,7 +37,7 @@ COMMANDLINE_ARGS="$@"
# For using instances
if ( basename $0 | grep "activemq-instance-" > /dev/null);then
INST="`basename $0|sed 's/^activemq-instance-//;s/\.sh$//'`"
- ACTIVEMQ_CONFIGS="/etc/default/activemq-instance-${INST} $HOME/.activemqrc-instance-${INST}"
+ ACTIVEMQ_CONFIGS="/etc/activemqrc-instance-${INST} $HOME/.activemqrc-instance-${INST}"
echo "INFO: Using alternative activemq configuration files: $ACTIVEMQ_CONFIGS"
fi
@@ -593,7 +593,6 @@ invoke_stop(){
echo
echo "INFO: Regular shutdown not successful, sending SIGKILL to process with pid '$PID'"
kill -KILL $PID
- RET="1"
fi
elif [ -f "$ACTIVEMQ_PIDFILE" ];then
echo "ERROR: No or outdated process id in '$ACTIVEMQ_PIDFILE'"
@@ -651,10 +650,10 @@ Tasks provided by the sysv init script:
(see next usage section)
Configuration of this script:
- The configuration of this script can be placed on /etc/default/activemq or $HOME/.activemqrc.
+ The configuration of this script can be placed on /etc/activemqrc or $HOME/.activemqrc.
To use additional configurations for running multiple instances on the same operating system
rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>.
- This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and
+ This changes the configuration location to /etc/activemqrc-instance-<INSTANCENAME> and
\$HOME/.activemqrc-instance-<INSTANCENAME>. Configuration files in /etc have higher precedence.
EOF
exit $RET

View File

@ -1,4 +1,9 @@
@comment $OpenBSD: PLIST,v 1.2 2013/03/02 12:31:35 jasper Exp $
@comment $OpenBSD: PLIST,v 1.3 2013/03/13 16:30:11 ajacoutot Exp $
@newgroup _activemq:714
@newuser _activemq:714:714:daemon:Apache ActiveMQ:/var/empty:/sbin/nologin
@extraunexec rm -rf %D/activemq/data/audit.log
@extraunexec rm -rf %D/activemq/data/*[!activemq.log]
@extraunexec rm -rf %D/activemq/tmp/*
activemq/
activemq/LICENSE
activemq/NOTICE
@ -11,41 +16,13 @@ activemq/bin/activemq-admin
activemq/bin/activemq.jar
activemq/bin/diag
activemq/bin/wrapper.jar
activemq/conf/
@sample ${SYSCONFDIR}/default/
activemq/conf/activemq-command.xml
activemq/conf/activemq-demo.xml
activemq/conf/activemq-dynamic-network-broker1.xml
activemq/conf/activemq-dynamic-network-broker2.xml
activemq/conf/activemq-jdbc.xml
activemq/conf/activemq-scalability.xml
activemq/conf/activemq-security.xml
activemq/conf/activemq-specjms.xml
activemq/conf/activemq-static-network-broker1.xml
activemq/conf/activemq-static-network-broker2.xml
activemq/conf/activemq-stomp.xml
activemq/conf/activemq-throughput.xml
activemq/conf/activemq.xml
activemq/conf/activemqrc
@sample ${SYSCONFDIR}/default/activemq
activemq/conf/broker-localhost.cert
activemq/conf/broker.ks
activemq/conf/broker.ts
activemq/conf/camel.xml
activemq/conf/client.ks
activemq/conf/client.ts
activemq/conf/credentials-enc.properties
activemq/conf/credentials.properties
activemq/conf/jetty-demo.xml
activemq/conf/jetty-realm.properties
activemq/conf/jetty.xml
activemq/conf/jmx.access
activemq/conf/jmx.password
activemq/conf/log4j.properties
activemq/conf/logging.properties
@owner _activemq
@group _activemq
activemq/data/
@comment no checksum
activemq/data/activemq.log
@owner
@group
activemq/docs/
activemq/docs/index.html
activemq/example/
@ -404,7 +381,70 @@ activemq/webapps/index.html
activemq/webapps/styles/
activemq/webapps/styles/site.css
activemq/webapps/styles/type-settings.css
bin/activemq
bin/activemq-admin
share/doc/pkg-readmes/${FULLPKGNAME}
share/examples/activemq/
share/examples/activemq/activemqrc
@sample ${SYSCONFDIR}/activemqrc
share/examples/activemq/conf/
@sample activemq/conf/
share/examples/activemq/conf/activemq-command.xml
@sample activemq/conf/activemq-command.xml
share/examples/activemq/conf/activemq-demo.xml
@sample activemq/conf/activemq-demo.xml
share/examples/activemq/conf/activemq-dynamic-network-broker1.xml
@sample activemq/conf/activemq-dynamic-network-broker1.xml
share/examples/activemq/conf/activemq-dynamic-network-broker2.xml
@sample activemq/conf/activemq-dynamic-network-broker2.xml
share/examples/activemq/conf/activemq-jdbc.xml
@sample activemq/conf/activemq-jdbc.xml
share/examples/activemq/conf/activemq-scalability.xml
@sample activemq/conf/activemq-scalability.xml
share/examples/activemq/conf/activemq-security.xml
@sample activemq/conf/activemq-security.xml
share/examples/activemq/conf/activemq-specjms.xml
@sample activemq/conf/activemq-specjms.xml
share/examples/activemq/conf/activemq-static-network-broker1.xml
@sample activemq/conf/activemq-static-network-broker1.xml
share/examples/activemq/conf/activemq-static-network-broker2.xml
@sample activemq/conf/activemq-static-network-broker2.xml
share/examples/activemq/conf/activemq-stomp.xml
@sample activemq/conf/activemq-stomp.xml
share/examples/activemq/conf/activemq-throughput.xml
@sample activemq/conf/activemq-throughput.xml
share/examples/activemq/conf/activemq.xml
@sample activemq/conf/activemq.xml
share/examples/activemq/conf/broker-localhost.cert
@sample activemq/conf/broker-localhost.cert
share/examples/activemq/conf/broker.ks
@sample activemq/conf/broker.ks
share/examples/activemq/conf/broker.ts
@sample activemq/conf/broker.ts
share/examples/activemq/conf/camel.xml
@sample activemq/conf/camel.xml
share/examples/activemq/conf/client.ks
@sample activemq/conf/client.ks
share/examples/activemq/conf/client.ts
@sample activemq/conf/client.ts
share/examples/activemq/conf/credentials-enc.properties
@sample activemq/conf/credentials-enc.properties
share/examples/activemq/conf/credentials.properties
@sample activemq/conf/credentials.properties
share/examples/activemq/conf/jetty-demo.xml
@sample activemq/conf/jetty-demo.xml
share/examples/activemq/conf/jetty-realm.properties
@sample activemq/conf/jetty-realm.properties
share/examples/activemq/conf/jetty.xml
@sample activemq/conf/jetty.xml
share/examples/activemq/conf/jmx.access
@sample activemq/conf/jmx.access
share/examples/activemq/conf/jmx.password
@sample activemq/conf/jmx.password
share/examples/activemq/conf/log4j.properties
@sample activemq/conf/log4j.properties
share/examples/activemq/conf/logging.properties
@sample activemq/conf/logging.properties
@owner _activemq
@group _activemq
@sample activemq/tmp/
@owner
@group
@rcscript ${RCDIR}/activemq

View File

@ -1,11 +0,0 @@
$OpenBSD: README,v 1.1.1.1 2013/02/05 15:08:45 jasper Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------
Configuration
=============
A default configuration file has been installed into
${SYSCONFDIR}/default/activemq. Please note that this may may need to
be adjusted for your setup.

View File

@ -1,8 +1,9 @@
#!/bin/sh
#
# $OpenBSD: activemq.rc,v 1.2 2013/03/04 15:48:41 ajacoutot Exp $
# $OpenBSD: activemq.rc,v 1.3 2013/03/13 16:30:11 ajacoutot Exp $
daemon="${TRUEPREFIX}/bin/activemq"
daemon="${TRUEPREFIX}/activemq/bin/activemq"
daemon_user="_activemq"
. /etc/rc.d/rc.subr
@ -13,12 +14,11 @@ rc_start() {
}
rc_check() {
PATH=$PATH:$(dirname $(${LOCALBASE}/bin/javaPathHelper -c apache-activemq)) ${daemon} status
PATH=$PATH:$(dirname $(${LOCALBASE}/bin/javaPathHelper -c apache-activemq)) ${daemon} status
}
rc_stop() {
pid=$(rc_check | tail -1 | perl -pi -e 's,.*pid \x27(.*)\x27.*,$1,g')
kill ${pid}
PATH=$PATH:$(dirname $(${LOCALBASE}/bin/javaPathHelper -c apache-activemq)) ${daemon} stop
}
rc_cmd $1