diff --git a/rabbitmq-script-wrapper b/rabbitmq-script-wrapper index c4f7709..3d2fc49 100644 --- a/rabbitmq-script-wrapper +++ b/rabbitmq-script-wrapper @@ -11,18 +11,19 @@ ## ## The Original Code is RabbitMQ. ## -## The Initial Developer of the Original Code is VMware, Inc. -## Copyright (c) 2007-2013 VMware, Inc. All rights reserved. +## The Initial Developer of the Original Code is GoPivotal, Inc. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## -# Escape spaces and quotes, because shell is revolting. +SED_OPT="-E" +if [ $(uname -s) = "Linux" ]; then + SED_OPT="-r" +fi + for arg in "$@" ; do - # Escape quotes in parameters, so that they're passed through cleanly. - arg=$(sed -e 's/"/\\"/g' <<-END - $arg - END - ) - CMDLINE="${CMDLINE} \"${arg}\"" + # Wrap each arg in single quotes and wrap single quotes in double quotes, so that they're passed through cleanly. + arg=`printf %s "$arg" | sed $SED_OPT -e "s/'/'\"'\"'/g"` + CMDLINE="${CMDLINE} '${arg}'" done cd /var/lib/rabbitmq @@ -30,9 +31,16 @@ cd /var/lib/rabbitmq SCRIPT=`basename $0` if [ `id -u` = `id -u rabbitmq` -a "$SCRIPT" = "rabbitmq-server" ] ; then - /usr/lib/rabbitmq/bin/rabbitmq-server "$@" + RABBITMQ_ENV=/usr/lib/rabbitmq/bin/rabbitmq-env + RABBITMQ_SCRIPTS_DIR=$(dirname "$RABBITMQ_ENV") + . "$RABBITMQ_ENV" + + exec /usr/lib/rabbitmq/bin/rabbitmq-server "$@" elif [ `id -u` = `id -u rabbitmq` -o "$SCRIPT" = "rabbitmq-plugins" ] ; then - /usr/lib/rabbitmq/bin/${SCRIPT} "$@" + if [ -f $PWD/.erlang.cookie ] ; then + export HOME=. + fi + exec /usr/lib/rabbitmq/bin/${SCRIPT} "$@" elif [ `id -u` = 0 ] ; then su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}" else diff --git a/rabbitmq-server.ocf b/rabbitmq-server.ocf index ba9579b..804e654 100755 --- a/rabbitmq-server.ocf +++ b/rabbitmq-server.ocf @@ -11,8 +11,8 @@ ## ## The Original Code is RabbitMQ. ## -## The Initial Developer of the Original Code is VMware, Inc. -## Copyright (c) 2007-2013 VMware, Inc. All rights reserved. +## The Initial Developer of the Original Code is GoPivotal, Inc. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## ## @@ -299,7 +299,7 @@ rabbit_stop() { return $OCF_SUCCESS fi - $RABBITMQ_CTL stop + $RABBITMQ_CTL stop ${RABBITMQ_PID_FILE} rc=$? if [ "$rc" != 0 ]; then diff --git a/rabbitmq-server.spec b/rabbitmq-server.spec index 90d73a9..afa7b7b 100644 --- a/rabbitmq-server.spec +++ b/rabbitmq-server.spec @@ -3,14 +3,17 @@ Name: rabbitmq-server Version: 3.5.6 -Release: 4%{?dist} +Release: 5%{?dist} License: MPLv1.1 Group: Development/Libraries Source: http://www.rabbitmq.com/releases/rabbitmq-server/v%{version}/%{name}-%{version}.tar.gz Source1: rabbitmq-server.init +# curl -O https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/231e90c/scripts/rabbitmq-script-wrapper +# sed -i -e "s, @STDOUT_STDERR_REDIRECTION@,,g" rabbitmq-script-wrapper +# sed -i -e "s,@SU_RABBITMQ_SH_C@,su rabbitmq -s /bin/sh -c,g" rabbitmq-script-wrapper Source2: rabbitmq-script-wrapper Source3: rabbitmq-server.logrotate -# curl -O https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/7cb5520/packaging/common/rabbitmq-server.ocf +# curl -O https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/231e90c/scripts/rabbitmq-server.ocf Source4: rabbitmq-server.ocf Source5: rabbitmq-server.tmpfiles Source6: rabbitmq-server.service @@ -211,6 +214,9 @@ fi rm -rf %{buildroot} %changelog +* Fri Dec 11 2015 Peter Lemenkov - 3.5.6-5 += Updated out-of-tarball scripts + * Fri Oct 23 2015 Peter Lemenkov - 3.5.6-4 - Added help subcommand for the scripts