summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-08-14 13:40:30 +0100
committerMatthew Sackman <matthew@lshift.net>2009-08-14 13:40:30 +0100
commite84abd31f517f05e50e9c61c57d95f2f70a1bd46 (patch)
treeb029db82f1cfcb638b75f51f4a801a3ed8c08b94
parent345d4d0ceb837d6a69a91b26d63349fc83837152 (diff)
parent98206e0cc2dd7f6ba24a6b23f99b6f37cbf6d6e0 (diff)
downloadrabbitmq-server-git-e84abd31f517f05e50e9c61c57d95f2f70a1bd46.tar.gz
merge bug20342 into default
-rw-r--r--Makefile17
-rwxr-xr-xcalculate-relative45
-rw-r--r--docs/rabbitmq-activate-plugins.1.pod35
-rw-r--r--packaging/RPMS/Fedora/rabbitmq-server.spec7
-rw-r--r--packaging/common/rabbitmq-asroot-script-wrapper53
-rw-r--r--packaging/common/rabbitmq-script-wrapper31
-rw-r--r--packaging/debs/Debian/debian/rules5
-rw-r--r--packaging/macports/net/rabbitmq-server/Portfile13
-rw-r--r--packaging/macports/net/rabbitmq-server/files/rabbitmq-asroot-script-wrapper12
-rw-r--r--packaging/windows/Makefile1
-rwxr-xr-xscripts/rabbitmq-activate-plugins (renamed from scripts/activate-plugins)14
-rw-r--r--scripts/rabbitmq-activate-plugins.bat (renamed from scripts/activate-plugins.bat)0
-rwxr-xr-xscripts/rabbitmq-env53
-rwxr-xr-xscripts/rabbitmq-multi4
-rwxr-xr-xscripts/rabbitmq-server4
-rwxr-xr-xscripts/rabbitmqctl4
16 files changed, 272 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 5c7f629327..c3b0c59829 100644
--- a/Makefile
+++ b/Makefile
@@ -136,7 +136,7 @@ srcdist: distclean
sed -i.save 's/%%VSN%%/$(VERSION)/' $(TARGET_SRC_DIR)/ebin/rabbit_app.in && rm -f $(TARGET_SRC_DIR)/ebin/rabbit_app.in.save
cp -r $(AMQP_CODEGEN_DIR)/* $(TARGET_SRC_DIR)/codegen/
- cp codegen.py Makefile generate_app $(TARGET_SRC_DIR)
+ cp codegen.py Makefile generate_app calculate-relative $(TARGET_SRC_DIR)
cp -r scripts $(TARGET_SRC_DIR)
cp -r docs $(TARGET_SRC_DIR)
@@ -162,7 +162,8 @@ distclean: clean
docs_all: $(MANPAGES)
-install: all docs_all
+install: SCRIPTS_REL_PATH=$(shell ./calculate-relative $(TARGET_DIR)/sbin $(SBIN_DIR))
+install: all docs_all install_dirs
@[ -n "$(TARGET_DIR)" ] || (echo "Please set TARGET_DIR."; false)
@[ -n "$(SBIN_DIR)" ] || (echo "Please set SBIN_DIR."; false)
@[ -n "$(MAN_DIR)" ] || (echo "Please set MAN_DIR."; false)
@@ -171,13 +172,17 @@ install: all docs_all
cp -r ebin include LICENSE LICENSE-MPL-RabbitMQ INSTALL $(TARGET_DIR)
chmod 0755 scripts/*
- mkdir -p $(SBIN_DIR)
- cp scripts/rabbitmq-server $(SBIN_DIR)
- cp scripts/rabbitmqctl $(SBIN_DIR)
- cp scripts/rabbitmq-multi $(SBIN_DIR)
+ for script in rabbitmq-env rabbitmq-server rabbitmqctl rabbitmq-multi rabbitmq-activate-plugins; do \
+ cp scripts/$$script $(TARGET_DIR)/sbin; \
+ [ -e $(SBIN_DIR)/$$script ] || ln -s $(SCRIPTS_REL_PATH)/$$script $(SBIN_DIR)/$$script; \
+ done
for section in 1 5; do \
mkdir -p $(MAN_DIR)/man$$section; \
for manpage in docs/*.$$section.pod; do \
cp docs/`basename $$manpage .pod`.gz $(MAN_DIR)/man$$section; \
done; \
done
+
+install_dirs:
+ mkdir -p $(SBIN_DIR)
+ mkdir -p $(TARGET_DIR)/sbin
diff --git a/calculate-relative b/calculate-relative
new file mode 100755
index 0000000000..3c3e2b1ff6
--- /dev/null
+++ b/calculate-relative
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+#
+# relpath.py
+# R.Barran 30/08/2004
+# Retrieved from http://code.activestate.com/recipes/302594/
+
+import os
+import sys
+
+def relpath(target, base=os.curdir):
+ """
+ Return a relative path to the target from either the current dir or an optional base dir.
+ Base can be a directory specified either as absolute or relative to current dir.
+ """
+
+ if not os.path.exists(target):
+ raise OSError, 'Target does not exist: '+target
+
+ if not os.path.isdir(base):
+ raise OSError, 'Base is not a directory or does not exist: '+base
+
+ base_list = (os.path.abspath(base)).split(os.sep)
+ target_list = (os.path.abspath(target)).split(os.sep)
+
+ # On the windows platform the target may be on a completely different drive from the base.
+ if os.name in ['nt','dos','os2'] and base_list[0] <> target_list[0]:
+ raise OSError, 'Target is on a different drive to base. Target: '+target_list[0].upper()+', base: '+base_list[0].upper()
+
+ # Starting from the filepath root, work out how much of the filepath is
+ # shared by base and target.
+ for i in range(min(len(base_list), len(target_list))):
+ if base_list[i] <> target_list[i]: break
+ else:
+ # If we broke out of the loop, i is pointing to the first differing path elements.
+ # If we didn't break out of the loop, i is pointing to identical path elements.
+ # Increment i so that in all cases it points to the first differing path elements.
+ i+=1
+
+ rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:]
+ if (len(rel_list) == 0):
+ return "."
+ return os.path.join(*rel_list)
+
+if __name__ == "__main__":
+ print(relpath(sys.argv[1], sys.argv[2]))
diff --git a/docs/rabbitmq-activate-plugins.1.pod b/docs/rabbitmq-activate-plugins.1.pod
new file mode 100644
index 0000000000..6bf9f6c474
--- /dev/null
+++ b/docs/rabbitmq-activate-plugins.1.pod
@@ -0,0 +1,35 @@
+=head1 NAME
+
+rabbitmq-activate-plugins - command line tool for activating plugins in a RabbitMQ broker
+
+=head1 SYNOPSIS
+
+rabbitmq-activate-plugins
+
+=head1 DESCRIPTION
+
+RabbitMQ is an implementation of AMQP, the emerging standard for high
+performance enterprise messaging. The RabbitMQ server is a robust and
+scalable implementation of an AMQP broker.
+
+rabbitmq-activate-plugins is a command line tool for activating plugins installed
+into the broker's plugins directory.
+
+=head1 EXAMPLES
+
+To activate all of the installed plugins in the current RabbitMQ install,
+execute:
+
+ rabbitmq-activate-plugins
+
+=head1 SEE ALSO
+
+rabbitmq.conf(5), rabbitmq-multi(1), rabbitmq-server(1), rabbitmqctl(1)
+
+=head1 AUTHOR
+
+The RabbitMQ Team <info@rabbitmq.com>
+
+=head1 REFERENCES
+
+RabbitMQ Web Site: http://www.rabbitmq.com
diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec
index eb953b81fa..7f442831de 100644
--- a/packaging/RPMS/Fedora/rabbitmq-server.spec
+++ b/packaging/RPMS/Fedora/rabbitmq-server.spec
@@ -9,6 +9,7 @@ Source: http://www.rabbitmq.com/releases/rabbitmq-server/v%{version}/%{name}-%{v
Source1: rabbitmq-server.init
Source2: rabbitmq-script-wrapper
Source3: rabbitmq-server.logrotate
+Source4: rabbitmq-asroot-script-wrapper
URL: http://www.rabbitmq.com/
BuildRequires: erlang, python-simplejson
Requires: erlang, logrotate
@@ -22,9 +23,10 @@ RabbitMQ is an implementation of AMQP, the emerging standard for high
performance enterprise messaging. The RabbitMQ server is a robust and
scalable implementation of an AMQP broker.
-%define _rabbit_erllibdir %{_libdir}/erlang/lib/rabbitmq_server-%{version}
+%define _rabbit_erllibdir %{_libdir}/rabbitmq/lib/rabbitmq_server-%{version}
%define _rabbit_libdir %{_libdir}/rabbitmq
%define _rabbit_wrapper %{_builddir}/`basename %{S:2}`
+%define _rabbit_asroot_wrapper %{_builddir}/`basename %{S:4}`
%define _maindir %{buildroot}%{_rabbit_erllibdir}
@@ -34,6 +36,8 @@ scalable implementation of an AMQP broker.
%build
cp %{S:2} %{_rabbit_wrapper}
sed -i 's|/usr/lib/|%{_libdir}/|' %{_rabbit_wrapper}
+cp %{S:4} %{_rabbit_asroot_wrapper}
+sed -i 's|/usr/lib/|%{_libdir}/|' %{_rabbit_asroot_wrapper}
make %{?_smp_mflags}
%install
@@ -51,6 +55,7 @@ install -p -D -m 0755 %{S:1} %{buildroot}%{_initrddir}/rabbitmq-server
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmqctl
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-server
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-multi
+install -p -D -m 0755 %{_rabbit_asroot_wrapper} %{buildroot}%{_sbindir}/rabbitmq-activate-plugins
install -p -D -m 0644 %{S:3} %{buildroot}%{_sysconfdir}/logrotate.d/rabbitmq-server
diff --git a/packaging/common/rabbitmq-asroot-script-wrapper b/packaging/common/rabbitmq-asroot-script-wrapper
new file mode 100644
index 0000000000..0dd1c0fbda
--- /dev/null
+++ b/packaging/common/rabbitmq-asroot-script-wrapper
@@ -0,0 +1,53 @@
+#!/bin/bash
+## 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 Developers of the Original Code are LShift Ltd,
+## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+## Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+## Ltd. Portions created by Cohesive Financial Technologies LLC are
+## Copyright (C) 2007-2009 Cohesive Financial Technologies
+## LLC. Portions created by Rabbit Technologies Ltd are Copyright
+## (C) 2007-2009 Rabbit Technologies Ltd.
+##
+## All Rights Reserved.
+##
+## Contributor(s): ______________________________________.
+##
+
+# Escape spaces and quotes, because shell is revolting.
+for arg in "$@" ; do
+ # Escape quotes in parameters, so that they're passed through cleanly.
+ arg=$(sed -e 's/"/\\"/' <<-END
+ $arg
+ END
+ )
+ CMDLINE="${CMDLINE} \"${arg}\""
+done
+
+cd /var/lib/rabbitmq
+
+SCRIPT=`basename $0`
+
+if [ `id -u` = 0 ] ; then
+ /usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}
+else
+ echo -e "\nOnly root should run ${SCRIPT}\n"
+ exit 1
+fi
+
diff --git a/packaging/common/rabbitmq-script-wrapper b/packaging/common/rabbitmq-script-wrapper
index 296a77d19c..f1a9b1ff0b 100644
--- a/packaging/common/rabbitmq-script-wrapper
+++ b/packaging/common/rabbitmq-script-wrapper
@@ -1,4 +1,35 @@
#!/bin/bash
+## 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 Developers of the Original Code are LShift Ltd,
+## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+## Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+## Ltd. Portions created by Cohesive Financial Technologies LLC are
+## Copyright (C) 2007-2009 Cohesive Financial Technologies
+## LLC. Portions created by Rabbit Technologies Ltd are Copyright
+## (C) 2007-2009 Rabbit Technologies Ltd.
+##
+## All Rights Reserved.
+##
+## Contributor(s): ______________________________________.
+##
+
# Escape spaces and quotes, because shell is revolting.
for arg in "$@" ; do
# Escape quotes in parameters, so that they're passed through cleanly.
diff --git a/packaging/debs/Debian/debian/rules b/packaging/debs/Debian/debian/rules
index 31904851a9..365eea6eb4 100644
--- a/packaging/debs/Debian/debian/rules
+++ b/packaging/debs/Debian/debian/rules
@@ -3,7 +3,7 @@
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk
-RABBIT_LIB=$(DEB_DESTDIR)usr/lib/erlang/lib/rabbitmq_server-$(DEB_UPSTREAM_VERSION)/
+RABBIT_LIB=$(DEB_DESTDIR)usr/lib/rabbitmq/lib/rabbitmq_server-$(DEB_UPSTREAM_VERSION)/
RABBIT_BIN=$(DEB_DESTDIR)usr/lib/rabbitmq/bin/
DEB_MAKE_INSTALL_TARGET := install TARGET_DIR=$(RABBIT_LIB) SBIN_DIR=$(RABBIT_BIN) MAN_DIR=$(DEB_DESTDIR)usr/share/man/
@@ -17,3 +17,6 @@ install/rabbitmq-server::
for script in rabbitmqctl rabbitmq-server rabbitmq-multi; do \
install -p -D -m 0755 debian/rabbitmq-script-wrapper $(DEB_DESTDIR)usr/sbin/$$script; \
done
+ for script in rabbitmq-activate-plugins; do \
+ install -p -D -m 0755 debian/rabbitmq-asroot-script-wrapper $(DEB_DESTDIR)usr/sbin/$$script; \
+ done
diff --git a/packaging/macports/net/rabbitmq-server/Portfile b/packaging/macports/net/rabbitmq-server/Portfile
index b8096d206d..1826d5c415 100644
--- a/packaging/macports/net/rabbitmq-server/Portfile
+++ b/packaging/macports/net/rabbitmq-server/Portfile
@@ -42,7 +42,7 @@ use_parallel_build yes
build.args PYTHON=${prefix}/bin/python2.5
destroot.destdir \
- TARGET_DIR=${destroot}${prefix}/lib/erlang/lib/rabbitmq_server-${version} \
+ TARGET_DIR=${destroot}${prefix}/lib/rabbitmq/lib/rabbitmq_server-${version} \
SBIN_DIR=${sbindir} \
MAN_DIR=${destroot}${prefix}/share/man
@@ -61,9 +61,7 @@ post-destroot {
xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${mnesiadbdir}
reinplace -E "s:(/etc/rabbitmq/rabbitmq.conf):${prefix}\\1:g" \
- ${sbindir}/rabbitmq-multi \
- ${sbindir}/rabbitmq-server \
- ${sbindir}/rabbitmqctl
+ ${sbindir}/rabbitmq-env
reinplace -E "s:(CLUSTER_CONFIG_FILE)=/:\\1=${prefix}/:" \
${sbindir}/rabbitmq-multi \
${sbindir}/rabbitmq-server \
@@ -83,14 +81,19 @@ post-destroot {
xinstall -m 555 ${filespath}/rabbitmq-script-wrapper \
${wrappersbin}/rabbitmq-multi
+ xinstall -m 555 ${filespath}/rabbitmq-asroot-script-wrapper \
+ ${wrappersbin}/rabbitmq-activate-plugins
reinplace -E "s:/usr/lib/rabbitmq/bin/:${prefix}/lib/rabbitmq/bin/:" \
${wrappersbin}/rabbitmq-multi
reinplace -E "s:/var/lib/rabbitmq:${prefix}/var/lib/rabbitmq:" \
${wrappersbin}/rabbitmq-multi
+ reinplace -E "s:/usr/lib/rabbitmq/bin/:${prefix}/lib/rabbitmq/bin/:" \
+ ${wrappersbin}/rabbitmq-activate-plugins
+ reinplace -E "s:/var/lib/rabbitmq:${prefix}/var/lib/rabbitmq:" \
+ ${wrappersbin}/rabbitmq-activate-plugins
file copy ${wrappersbin}/rabbitmq-multi ${wrappersbin}/rabbitmq-server
file copy ${wrappersbin}/rabbitmq-multi ${wrappersbin}/rabbitmqctl
-
}
pre-install {
diff --git a/packaging/macports/net/rabbitmq-server/files/rabbitmq-asroot-script-wrapper b/packaging/macports/net/rabbitmq-server/files/rabbitmq-asroot-script-wrapper
new file mode 100644
index 0000000000..c4488dcbe5
--- /dev/null
+++ b/packaging/macports/net/rabbitmq-server/files/rabbitmq-asroot-script-wrapper
@@ -0,0 +1,12 @@
+#!/bin/bash
+cd /var/lib/rabbitmq
+
+SCRIPT=`basename $0`
+
+if [ `id -u` = 0 ] ; then
+ /usr/lib/rabbitmq/bin/${SCRIPT} "$@"
+else
+ echo -e "\nOnly root should run ${SCRIPT}\n"
+ exit 1
+fi
+
diff --git a/packaging/windows/Makefile b/packaging/windows/Makefile
index 59101cb2c6..28f7931907 100644
--- a/packaging/windows/Makefile
+++ b/packaging/windows/Makefile
@@ -13,6 +13,7 @@ dist:
mv $(SOURCE_DIR)/scripts/rabbitmq-service.bat $(SOURCE_DIR)/sbin
mv $(SOURCE_DIR)/scripts/rabbitmqctl.bat $(SOURCE_DIR)/sbin
mv $(SOURCE_DIR)/scripts/rabbitmq-multi.bat $(SOURCE_DIR)/sbin
+ mv $(SOURCE_DIR)/scripts/rabbitmq-activate-plugins.bat $(SOURCE_DIR)/sbin
rm -rf $(SOURCE_DIR)/scripts
rm -rf $(SOURCE_DIR)/codegen* $(SOURCE_DIR)/Makefile
rm -f $(SOURCE_DIR)/README
diff --git a/scripts/activate-plugins b/scripts/rabbitmq-activate-plugins
index 52f7ddbe61..5ce64c686c 100755
--- a/scripts/activate-plugins
+++ b/scripts/rabbitmq-activate-plugins
@@ -30,18 +30,18 @@
## Contributor(s): ______________________________________.
##
-[ -f /etc/rabbitmq/rabbitmq.conf ] && . /etc/rabbitmq/rabbitmq.conf
+. `dirname $0`/rabbitmq-env
-RABBITMQ_EBIN=`dirname $0`/../ebin
-[ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR="`dirname $0`/../plugins"
-[ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR="`dirname $0`/../priv/plugins"
+RABBITMQ_EBIN=${RABBITMQ_HOME}/ebin
+[ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
+[ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR="${RABBITMQ_HOME}/priv/plugins"
exec erl \
-pa "$RABBITMQ_EBIN" \
-rabbit plugins_dir "\"$RABBITMQ_PLUGINS_DIR\"" \
- -rabbit plugins_expand_dir "\"$RABBITMQ_PLUGINS_EXPAND_DIR\"" \
- -rabbit rabbit_ebin "\"$RABBITMQ_EBIN\"" \
- -noinput \
+ -rabbit plugins_expand_dir "\"$RABBITMQ_PLUGINS_EXPAND_DIR\"" \
+ -rabbit rabbit_ebin "\"$RABBITMQ_EBIN\"" \
+ -noinput \
-hidden \
-s rabbit_plugin_activator \
-extra "$@"
diff --git a/scripts/activate-plugins.bat b/scripts/rabbitmq-activate-plugins.bat
index 8bef4ad266..8bef4ad266 100644
--- a/scripts/activate-plugins.bat
+++ b/scripts/rabbitmq-activate-plugins.bat
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env
new file mode 100755
index 0000000000..ac3b77da91
--- /dev/null
+++ b/scripts/rabbitmq-env
@@ -0,0 +1,53 @@
+#!/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 Developers of the Original Code are LShift Ltd,
+## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+## Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+## Ltd. Portions created by Cohesive Financial Technologies LLC are
+## Copyright (C) 2007-2009 Cohesive Financial Technologies
+## LLC. Portions created by Rabbit Technologies Ltd are Copyright
+## (C) 2007-2009 Rabbit Technologies Ltd.
+##
+## All Rights Reserved.
+##
+## Contributor(s): ______________________________________.
+##
+
+# Determine where this script is really located
+SCRIPT_PATH="$0"
+while [ -h "$SCRIPT_PATH" ] ; do
+ FULL_PATH=`readlink -f $SCRIPT_PATH 2>/dev/null`
+ if [ "$?" != "0" ]; then
+ REL_PATH=`readlink $SCRIPT_PATH`
+ if expr "$REL_PATH" : '/.*' > /dev/null; then
+ SCRIPT_PATH="$link"
+ else
+ SCRIPT_PATH="`dirname "$SCRIPT_PATH"`/$REL_PATH"
+ fi
+ else
+ SCRIPT_PATH=$FULL_PATH
+ fi
+done
+
+SCRIPT_DIR=`dirname $SCRIPT_PATH`
+RABBITMQ_HOME="${SCRIPT_DIR}/.."
+
+# Load configuration from the rabbitmq.conf file
+[ -f /etc/rabbitmq/rabbitmq.conf ] && . /etc/rabbitmq/rabbitmq.conf
diff --git a/scripts/rabbitmq-multi b/scripts/rabbitmq-multi
index 1d0c785f6b..7db4cb70b2 100755
--- a/scripts/rabbitmq-multi
+++ b/scripts/rabbitmq-multi
@@ -37,7 +37,7 @@ PIDS_FILE=/var/lib/rabbitmq/pids
MULTI_ERL_ARGS=
MULTI_START_ARGS=
-[ -f /etc/rabbitmq/rabbitmq.conf ] && . /etc/rabbitmq/rabbitmq.conf
+. `dirname $0`/rabbitmq-env
[ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME}
[ "x" = "x$RABBITMQ_NODE_IP_ADDRESS" ] && RABBITMQ_NODE_IP_ADDRESS=${NODE_IP_ADDRESS}
@@ -60,7 +60,7 @@ export \
set -f
exec erl \
- -pa "`dirname $0`/../ebin" \
+ -pa "${RABBITMQ_HOME}/ebin" \
-noinput \
-hidden \
${RABBITMQ_MULTI_ERL_ARGS} \
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 41e84639ba..547220b4a5 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -41,7 +41,7 @@ LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia
SERVER_START_ARGS=
-[ -f /etc/rabbitmq/rabbitmq.conf ] && . /etc/rabbitmq/rabbitmq.conf
+. `dirname $0`/rabbitmq-env
[ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME}
[ "x" = "x$RABBITMQ_NODE_IP_ADDRESS" ] && RABBITMQ_NODE_IP_ADDRESS=${NODE_IP_ADDRESS}
@@ -75,7 +75,7 @@ fi
RABBITMQ_START_RABBIT=
[ "x" = "x$RABBITMQ_NODE_ONLY" ] && RABBITMQ_START_RABBIT='-noinput -s rabbit'
-RABBITMQ_EBIN_ROOT="`dirname $0`/../ebin"
+RABBITMQ_EBIN_ROOT="${RABBITMQ_HOME}/ebin"
if [ -f "${RABBITMQ_EBIN_ROOT}/rabbit.boot" ]; then
RABBITMQ_BOOT_FILE="${RABBITMQ_EBIN_ROOT}/rabbit"
RABBITMQ_EBIN_PATH=""
diff --git a/scripts/rabbitmqctl b/scripts/rabbitmqctl
index c57978c050..9c45e73dd5 100755
--- a/scripts/rabbitmqctl
+++ b/scripts/rabbitmqctl
@@ -30,12 +30,12 @@
## Contributor(s): ______________________________________.
##
-[ -f /etc/rabbitmq/rabbitmq.conf ] && . /etc/rabbitmq/rabbitmq.conf
+. `dirname $0`/rabbitmq-env
[ "x" = "x$RABBITMQ_CTL_ERL_ARGS" ] && RABBITMQ_CTL_ERL_ARGS=${CTL_ERL_ARGS}
exec erl \
- -pa "`dirname $0`/../ebin" \
+ -pa "${RABBITMQ_HOME}/ebin" \
-noinput \
-hidden \
${RABBITMQ_CTL_ERL_ARGS} \