diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-09-25 11:31:14 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien.pedron@dumbbell.fr> | 2015-10-20 11:10:48 +0200 |
| commit | b6ea6e9ef9a14f610b42a47813769c5268cd95b0 (patch) | |
| tree | 485f442dc5f38cccd3145434d28a8393bbdc0629 /scripts | |
| parent | 00976770611cebf8a2970162296c931c03a44197 (diff) | |
| download | rabbitmq-server-git-b6ea6e9ef9a14f610b42a47813769c5268cd95b0.tar.gz | |
rabbitmq-env: Adjust RABBITMQ_*PLUGINS* if running from dev env
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/rabbitmq-env | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env index 167f63356f..c19338205c 100755 --- a/scripts/rabbitmq-env +++ b/scripts/rabbitmq-env @@ -236,19 +236,43 @@ rmq_check_if_shared_with_mnesia \ ##--- End of overridden <var_name> variables ## Development-specific environment. -if [ -f "${RABBITMQ_HOME}/erlang.mk" ]; then +if [ "${RABBITMQ_DEV_ENV}" ]; then # When RabbitMQ or the rabbitmq* scripts are started from the source # directory, they need the location of rabbit_common. + + DEPS_DIR_norm="${DEPS_DIR}" + rmq_normalize_path_var DEPS_DIR_norm + if [ -d "${RABBITMQ_PLUGINS_DIR}" ]; then + # RabbitMQ was started with "make run-broker". Take + # rabbit_common from the plugins directory. ERL_LIBS="${RABBITMQ_PLUGINS_DIR}:${ERL_LIBS}" - elif [ -d "${RABBITMQ_HOME}/deps/rabbit_common/ebin" ]; then - ERL_LIBS="${RABBITMQ_HOME}/deps:${ERL_LIBS}" - fi - if [ "${DEPS_DIR}" -a -d "$(dirname "${DEPS_DIR}")" ]; then - ERL_LIBS="$(dirname ${DEPS_DIR})/plugins:${ERL_LIBS}" + elif [ "${DEPS_DIR_norm}" -a -d "${DEPS_DIR_norm}/rabbit_common/ebin" ]; then + # RabbitMQ runs from a testsuite. The .ez files are not created + # in this case, take DEPS_DIR directly. + ERL_LIBS="${DEPS_DIR_norm}:${ERL_LIBS}" fi + ERL_LIBS=${ERL_LIBS%:} export ERL_LIBS + + if [ "$(basename "$0")" = 'rabbitmq-plugins' ]; then + # We need to query the running node for the plugins directory + # and the "enabled plugins" file. + eval $( (${RABBITMQ_SCRIPTS_DIR}/rabbitmqctl eval \ + '{ok, P} = application:get_env(rabbit, plugins_dir), + {ok, E} = application:get_env(rabbit, enabled_plugins_file), + io:format( + "plugins_dir=\"~s\"~n" + "enabled_plugins_file=\"~s\"~n", [P, E]).' \ + 2>/dev/null | head -n 2) || :) + if [ "${plugins_dir}" ]; then + RABBITMQ_PLUGINS_DIR="${plugins_dir}" + fi + if [ "${enabled_plugins_file}" ]; then + RABBITMQ_ENABLED_PLUGINS_FILE="${enabled_plugins_file}" + fi + fi fi RABBITMQ_ENV_LOADED=1 |
