summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-03-01 12:33:10 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-03-01 12:33:10 +0000
commitc60c999c2086d1f2d843cde36bc1a91fa7b698d3 (patch)
tree1b87f8705e31334d0b7c4b85bcb02dffd2a1d06d
parente9b8a4bd66330440bf204109810ce70d055a5bd6 (diff)
parent32339c7c50138930163074dc1cdea35ac3284ded (diff)
downloadrabbitmq-server-c60c999c2086d1f2d843cde36bc1a91fa7b698d3.tar.gz
Merge bug 22961
-rw-r--r--Makefile2
-rw-r--r--packaging/generic-unix/Makefile7
-rw-r--r--packaging/macports/Makefile5
-rw-r--r--packaging/macports/Portfile.in12
-rw-r--r--scripts/rabbitmq-defaults30
-rwxr-xr-xscripts/rabbitmq-env25
6 files changed, 58 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 92d9fa82..e8975856 100644
--- a/Makefile
+++ b/Makefile
@@ -316,7 +316,7 @@ install_bin: all install_dirs
cp -r ebin include LICENSE* INSTALL $(TARGET_DIR)
chmod 0755 scripts/*
- for script in rabbitmq-env rabbitmq-server rabbitmqctl rabbitmq-plugins; do \
+ for script in rabbitmq-env rabbitmq-server rabbitmqctl rabbitmq-plugins rabbitmq-defaults; do \
cp scripts/$$script $(TARGET_DIR)/sbin; \
[ -e $(SBIN_DIR)/$$script ] || ln -s $(SCRIPTS_REL_PATH)/$$script $(SBIN_DIR)/$$script; \
done
diff --git a/packaging/generic-unix/Makefile b/packaging/generic-unix/Makefile
index b5c342aa..b6ef9532 100644
--- a/packaging/generic-unix/Makefile
+++ b/packaging/generic-unix/Makefile
@@ -12,6 +12,13 @@ dist:
MAN_DIR=`pwd`/$(TARGET_DIR)/share/man \
install
+ sed -e 's:^SYS_PREFIX=$$:SYS_PREFIX=\$${RABBITMQ_HOME}:' \
+ $(TARGET_DIR)/sbin/rabbitmq-defaults >$(TARGET_DIR)/sbin/rabbitmq-defaults.tmp \
+ && mv $(TARGET_DIR)/sbin/rabbitmq-defaults.tmp $(TARGET_DIR)/sbin/rabbitmq-defaults
+ chmod 0755 $(TARGET_DIR)/sbin/rabbitmq-defaults
+
+ mkdir -p $(TARGET_DIR)/etc/rabbitmq
+
tar -zcf $(TARGET_TARBALL).tar.gz $(TARGET_DIR)
rm -rf $(SOURCE_DIR) $(TARGET_DIR)
diff --git a/packaging/macports/Makefile b/packaging/macports/Makefile
index 47da02dc..897fc183 100644
--- a/packaging/macports/Makefile
+++ b/packaging/macports/Makefile
@@ -38,9 +38,8 @@ $(DEST)/Portfile: Portfile.in
# needs vars such as HOME to be set. So we have to set them
# explicitly.
macports: dirs $(DEST)/Portfile
- cp $(COMMON_DIR)/rabbitmq-script-wrapper $(DEST)/files
- sed -i -e 's|@SU_RABBITMQ_SH_C@|SHELL=/bin/sh HOME=/var/lib/rabbitmq USER=rabbitmq LOGNAME=rabbitmq PATH="$$(eval `PATH=MACPORTS_PREFIX/bin /usr/libexec/path_helper -s`; echo $$PATH)" su -m rabbitmq -c|' \
- $(DEST)/files/rabbitmq-script-wrapper
+ sed -e 's|@SU_RABBITMQ_SH_C@|SHELL=/bin/sh HOME=/var/lib/rabbitmq USER=rabbitmq LOGNAME=rabbitmq PATH="$$(eval `PATH=@MACPORTS_PREFIX@/bin /usr/libexec/path_helper -s`; echo $$PATH)" su -m rabbitmq -c|' \
+ $(COMMON_DIR)/rabbitmq-script-wrapper >$(DEST)/files/rabbitmq-script-wrapper
cp patch-org.macports.rabbitmq-server.plist.diff $(DEST)/files
if [ -n "$(MACPORTS_USERHOST)" ] ; then \
tar cf - -C $(MACPORTS_DIR) . | ssh $(SSH_OPTS) $(MACPORTS_USERHOST) ' \
diff --git a/packaging/macports/Portfile.in b/packaging/macports/Portfile.in
index cde02b1a..e461e49e 100644
--- a/packaging/macports/Portfile.in
+++ b/packaging/macports/Portfile.in
@@ -90,16 +90,14 @@ post-destroot {
xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${serverhome}
xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${mnesiadbdir}
- reinplace -E "s: (/etc/rabbitmq/rabbitmq): ${prefix}\\1:g" \
- ${realsbin}/rabbitmq-env
- foreach var {CONFIG_FILE LOG_BASE MNESIA_BASE ENABLED_PLUGINS_FILE} {
- reinplace -E "s:^($var)=/:\\1=${prefix}/:" \
- ${realsbin}/rabbitmq-env
- }
+ reinplace -E "s:^SYS_PREFIX=\${RABBITMQ_HOME}$:SYS_PREFIX=${prefix}:" \
+ ${realsbin}/rabbitmq-defaults
+ reinplace -E "s:^SYS_PREFIX=$:SYS_PREFIX=${prefix}:" \
+ ${realsbin}/rabbitmq-defaults
xinstall -m 555 ${filespath}/rabbitmq-script-wrapper \
${wrappersbin}/rabbitmq-server
- reinplace -E "s:MACPORTS_PREFIX/bin:${prefix}/bin:g" \
+ reinplace -E "s:@MACPORTS_PREFIX@:${prefix}:g" \
${wrappersbin}/rabbitmq-server
reinplace -E "s:/usr/lib/rabbitmq/bin/:${prefix}/lib/rabbitmq/bin/:g" \
${wrappersbin}/rabbitmq-server
diff --git a/scripts/rabbitmq-defaults b/scripts/rabbitmq-defaults
new file mode 100644
index 00000000..4763f086
--- /dev/null
+++ b/scripts/rabbitmq-defaults
@@ -0,0 +1,30 @@
+#!/bin/sh
+## The contents of this file are subject to the Mozilla Public License
+## Version 1.1 (the "License"); you may not use this file except in
+## compliance with the License. You may obtain a copy of the License
+## at http://www.mozilla.org/MPL/
+##
+## Software distributed under the License is distributed on an "AS IS"
+## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+## the License for the specific language governing rights and
+## limitations under the License.
+##
+## The Original Code is RabbitMQ.
+##
+## The Initial Developer of the Original Code is VMware, Inc.
+## Copyright (c) 2012 VMware, Inc. All rights reserved.
+##
+
+### next line potentially updated in package install steps
+SYS_PREFIX=
+
+## Set default values
+
+CONFIG_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq
+LOG_BASE=${SYS_PREFIX}/var/log/rabbitmq
+MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia
+ENABLED_PLUGINS_FILE=${SYS_PREFIX}/etc/rabbitmq/enabled_plugins
+
+PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
+
+CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env
index 1fd1339d..23224943 100755
--- a/scripts/rabbitmq-env
+++ b/scripts/rabbitmq-env
@@ -15,7 +15,8 @@
## Copyright (c) 2007-2012 VMware, Inc. All rights reserved.
##
-# Determine where this script is really located
+# Determine where this script is really located (if this script is
+# invoked from another script, this is the location of the caller)
SCRIPT_PATH="$0"
while [ -h "$SCRIPT_PATH" ] ; do
FULL_PATH=`readlink -f $SCRIPT_PATH 2>/dev/null`
@@ -36,19 +37,19 @@ RABBITMQ_HOME="${SCRIPT_DIR}/.."
[ "x" = "x$HOSTNAME" ] && HOSTNAME=`env hostname`
NODENAME=rabbit@${HOSTNAME%%.*}
-## Set (non-empty) default values for rabbitmq-env.conf variables to override
+## Set defaults
+. ${SCRIPT_DIR}/rabbitmq-defaults
+
+## Common defaults
SERVER_ERL_ARGS="+K true +A30 +P 1048576 \
--kernel inet_default_connect_options [{nodelay,true}]"
-CONFIG_FILE=/etc/rabbitmq/rabbitmq
-LOG_BASE=/var/log/rabbitmq
-MNESIA_BASE=/var/lib/rabbitmq/mnesia
-PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
-ENABLED_PLUGINS_FILE=/etc/rabbitmq/enabled_plugins
+ -kernel inet_default_connect_options [{nodelay,true}]"
-## Load configuration from the rabbitmq.conf file
+# warn about old rabbitmq.conf file, if no new one
if [ -f /etc/rabbitmq/rabbitmq.conf ] && \
- [ ! -f /etc/rabbitmq/rabbitmq-env.conf ] ; then
+ [ ! -f ${CONF_ENV_FILE} ] ; then
echo -n "WARNING: ignoring /etc/rabbitmq/rabbitmq.conf -- "
- echo "location has moved to /etc/rabbitmq/rabbitmq-env.conf"
+ echo "location has moved to ${CONF_ENV_FILE}"
fi
-[ -f /etc/rabbitmq/rabbitmq-env.conf ] && . /etc/rabbitmq/rabbitmq-env.conf
+
+## Get configuration variables from the configure environment file
+[ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE}