summaryrefslogtreecommitdiff
path: root/scripts/activate-plugins
diff options
context:
space:
mode:
authorPaul Jones <paulj@lshift.net>2009-07-29 09:42:51 +0100
committerPaul Jones <paulj@lshift.net>2009-07-29 09:42:51 +0100
commit9398b1a9413be8430c061c5f0513aca55eb3264a (patch)
tree2d2f3250a839054220cc97f178f6d687ff1ea2c8 /scripts/activate-plugins
parent39d8c604b32471fbf0afac857f02f0793c7d44e6 (diff)
downloadrabbitmq-server-git-9398b1a9413be8430c061c5f0513aca55eb3264a.tar.gz
Patched all scripts to be able to auto-detect their directory, even when symlinked
Diffstat (limited to 'scripts/activate-plugins')
-rwxr-xr-xscripts/activate-plugins25
1 files changed, 19 insertions, 6 deletions
diff --git a/scripts/activate-plugins b/scripts/activate-plugins
index 52f7ddbe61..536b5d353e 100755
--- a/scripts/activate-plugins
+++ b/scripts/activate-plugins
@@ -30,18 +30,31 @@
## Contributor(s): ______________________________________.
##
+SCRIPT_PATH="$0"
+while [ -h "$SCRIPT_PATH" ] ; do
+ ls=`ls -ld "$SCRIPT_PATH"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT_PATH="$link"
+ else
+ SCRIPT_PATH="`dirname "$SCRIPT_PATH"`/$link"
+ fi
+done
+SCRIPT_DIR=`dirname $SCRIPT_PATH`
+
[ -f /etc/rabbitmq/rabbitmq.conf ] && . /etc/rabbitmq/rabbitmq.conf
-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=${SCRIPT_DIR}/../ebin
+echo $RABBITMQ_EBIN
+[ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR="${SCRIPT_DIR}/../plugins"
+[ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR="${SCRIPT_DIR}/../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 "$@"