summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Fedotov <dfedotov@pivotal.io>2016-11-29 16:35:45 +0000
committerDaniil Fedotov <dfedotov@pivotal.io>2016-11-29 16:35:45 +0000
commit475e86b505d5b84e7140385692d0c80e33bca6fd (patch)
treed5d785ca217219c536791728ae6e6006be74cfa6 /scripts
parent55451523b84168ceeb36398f7a8e6734b35e969a (diff)
parentb907d34689879da7e9f2f4991d61e344a48cce30 (diff)
downloadrabbitmq-server-git-475e86b505d5b84e7140385692d0c80e33bca6fd.tar.gz
Merge branch 'master' into rabbitmq-server-567
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rabbitmq-defaults11
-rwxr-xr-xscripts/rabbitmq-env26
2 files changed, 31 insertions, 6 deletions
diff --git a/scripts/rabbitmq-defaults b/scripts/rabbitmq-defaults
index 5342978694..fdcf624d1b 100755
--- a/scripts/rabbitmq-defaults
+++ b/scripts/rabbitmq-defaults
@@ -44,4 +44,15 @@ SCHEMA_DIR=${SYS_PREFIX}/var/lib/rabbitmq/schema
PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
+# RABBIT_HOME can contain a version number, so default plugins
+# directory can be hard to find if we want to package some plugin
+# separately. When RABBITMQ_HOME points to a standard location where
+# it's usally being installed by package managers, we add
+# "/usr/lib/rabbitmq/plugins" to plugin search path.
+case "$RABBITMQ_HOME" in
+ /usr/lib/rabbitmq/*)
+ PLUGINS_DIR="/usr/lib/rabbitmq/plugins:$PLUGINS_DIR"
+ ;;
+esac
+
CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env
index f1962e2b7b..d975f274b2 100755
--- a/scripts/rabbitmq-env
+++ b/scripts/rabbitmq-env
@@ -57,6 +57,20 @@ rmq_realpath() {
fi
}
+path_contains_existing_directory() {
+ local path="${1:?}"
+ local dir
+ local rc
+ local IFS="
+ "
+ for dir in $(echo "$path" | tr ':' '\n'); do
+ if [ -d "$dir" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
RABBITMQ_HOME="$(rmq_realpath "${RABBITMQ_SCRIPTS_DIR}/..")"
ESCRIPT_DIR="${RABBITMQ_HOME}/escript"
@@ -108,8 +122,9 @@ fi
rmq_normalize_path() {
local path=$1
- # Remove redundant slashes and strip a trailing slash
- echo "$path" | sed -e 's#/\{2,\}#/#g' -e 's#/$##'
+ # Remove redundant slashes and strip a trailing slash for a
+ # PATH-like vars - ':' is the delimiter
+ echo "$path" | sed -e 's#/\{2,\}#/#g' -e 's#/$##' -e 's#/:#:#g'
}
rmq_normalize_path_var() {
@@ -265,9 +280,8 @@ if [ "${RABBITMQ_DEV_ENV}" ]; then
RABBITMQ_ENABLED_PLUGINS_FILE="${enabled_plugins_file}"
fi
fi
-
-
- if [ -d "${RABBITMQ_PLUGINS_DIR}" ]; then
+
+ if path_contains_existing_directory "${RABBITMQ_PLUGINS_DIR}" ; then
# RabbitMQ was started with "make run-broker" from its own
# source tree. Take rabbit_common from the plugins directory.
ERL_LIBS="${RABBITMQ_PLUGINS_DIR}:${ERL_LIBS}"
@@ -291,7 +305,7 @@ if [ "${RABBITMQ_DEV_ENV}" ]; then
ERL_LIBS="${DEPS_DIR_norm}:${ERL_LIBS}"
fi
else
- if [ -d "${RABBITMQ_PLUGINS_DIR}" ]; then
+ if path_contains_existing_directory "${RABBITMQ_PLUGINS_DIR}" ; then
# RabbitMQ was started from its install directory. Take
# rabbit_common from the plugins directory.
ERL_LIBS="${RABBITMQ_PLUGINS_DIR}:${ERL_LIBS}"