summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2008-03-21 15:42:14 +0000
committerChristophe Romain <christophe.romain@process-one.net>2008-03-21 15:42:14 +0000
commit618af5e07addd5b8d3d514fe3fe2edb5dadfd332 (patch)
treeea0ab5f0c3bf010d04128c00357b2875e3afe500
parentRewrite io:format calls to loglevel macros (EJAB-555) (diff)
Seek epam binary into priv/bin (EJAB-573)
SVN Revision: 1243
-rw-r--r--ChangeLog8
-rw-r--r--src/Makefile.in4
-rw-r--r--src/ejabberd.erl15
-rw-r--r--src/ejabberdctl.template2
-rw-r--r--src/pam/epam.erl2
-rwxr-xr-xtools/ejabberdctl1
6 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2157b098..ef446182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-21 Christophe Romain <christophe.romain@process-one.net>
+
+ * src/pam/epam.erl: Seek epam binary into priv/bin (EJAB-573)
+ * src/ejabberd.erl: Likewise
+ * src/Makefile.in: Likewise
+ * src/ejabberdctl.template: Likewise
+ * tools/ejabberdctl: Likewise
+
2008-03-21 Badlop <badlop@process-one.net>
* src/cyrsasl_digest.erl: Rewrite io:format calls to loglevel
diff --git a/src/Makefile.in b/src/Makefile.in
index c05c2ebf..6676e19d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -54,6 +54,7 @@ EJABBERDDIR = $(DESTDIR)@prefix@/var/lib/ejabberd
BEAMDIR = $(EJABBERDDIR)/ebin
PRIVDIR = $(EJABBERDDIR)/priv
SODIR = $(PRIVDIR)/lib
+PBINDIR = $(PRIVDIR)/bin
MSGSDIR = $(PRIVDIR)/msgs
LOGDIR = $(DESTDIR)@prefix@/var/log/ejabberd
ETCDIR = $(DESTDIR)@prefix@/etc/ejabberd
@@ -101,8 +102,9 @@ install: all
rm -f $(BEAMDIR)/configure.beam
install -m 644 *.app $(BEAMDIR)
install -d $(SODIR)
+ install -d $(PBINDIR)
install -m 644 *.so $(SODIR)
- -install -m 750 epam $(SODIR)
+ install -m 750 epam $(PBINDIR)
install -d $(MSGSDIR)
install -m 644 msgs/*.msg $(MSGSDIR)
install -d $(ETCDIR)
diff --git a/src/ejabberd.erl b/src/ejabberd.erl
index 323b4c91..de2727ca 100644
--- a/src/ejabberd.erl
+++ b/src/ejabberd.erl
@@ -28,7 +28,7 @@
-author('alexey@process-one.net').
-export([start/0, stop/0,
- get_so_path/0]).
+ get_so_path/0, get_bin_path/0]).
start() ->
application:start(ejabberd).
@@ -49,3 +49,16 @@ get_so_path() ->
Path ->
Path
end.
+
+get_bin_path() ->
+ case os:getenv("EJABBERD_BIN_PATH") of
+ false ->
+ case code:priv_dir(ejabberd) of
+ {error, _} ->
+ ".";
+ Path ->
+ filename:join([Path, "bin"])
+ end;
+ Path ->
+ Path
+ end.
diff --git a/src/ejabberdctl.template b/src/ejabberdctl.template
index fd5a1d08..f50b9858 100644
--- a/src/ejabberdctl.template
+++ b/src/ejabberdctl.template
@@ -45,6 +45,7 @@ ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES"
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs
EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib
+EJABBERD_BIN_PATH=$ROOTDIR/var/lib/ejabberd/priv/bin
EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log
SASL_LOG_PATH=$LOGS_DIR/sasl.log
DATETIME=`date "+%Y%m%d-%H%M%S"`
@@ -57,6 +58,7 @@ export EJABBERD_CONFIG_PATH
export EJABBERD_MSGS_PATH
export EJABBERD_LOG_PATH
export EJABBERD_SO_PATH
+export EJABBERD_BIN_PATH
export ERL_CRASH_DUMP
export ERL_INETRC
export ERL_MAX_PORTS
diff --git a/src/pam/epam.erl b/src/pam/epam.erl
index 40431193..df24496b 100644
--- a/src/pam/epam.erl
+++ b/src/pam/epam.erl
@@ -79,7 +79,7 @@ acct_mgmt(Srv, User) when is_list(Srv), is_list(User) ->
%% gen_server callbacks
%%====================================================================
init([]) ->
- FileName = filename:join(ejabberd:get_so_path(), "epam"),
+ FileName = filename:join(ejabberd:get_bin_path(), "epam"),
case file:read_file_info(FileName) of
{ok, Info} ->
Mode = Info#file_info.mode band 16#801,
diff --git a/tools/ejabberdctl b/tools/ejabberdctl
index 8b16785d..9d3f7bd5 100755
--- a/tools/ejabberdctl
+++ b/tools/ejabberdctl
@@ -13,6 +13,7 @@ export EJABBERD_LOG_PATH=$ROOTDIR/ejabberd.log
export EJABBERD_CONFIG_PATH=$ROOTDIR/ejabberd.cfg
export EJABBERD_MSGS_PATH=$ROOTDIR/src/msgs
export EJABBERD_SO_PATH=$ROOTDIR/src
+export EJABBERD_BIN_PATH=$ROOTDIR/src
export ERL_MAX_PORTS=32000
[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB