try ejabberdctl fix
Barış Metin [Mon, 15 Mar 2010 15:54:19 +0000 (15:54 +0000)]
ejabberd-ejabberdctl_fix.diff [new file with mode: 0644]
ejabberd.spec

diff --git a/ejabberd-ejabberdctl_fix.diff b/ejabberd-ejabberdctl_fix.diff
new file mode 100644 (file)
index 0000000..8c8a27b
--- /dev/null
@@ -0,0 +1,82 @@
+--- src/ejabberdctl.template   2009-04-01 19:23:51.000000000 +0400
++++ src/ejabberdctl.template   2009-08-25 23:06:19.258685929 +0400
+@@ -9,13 +9,14 @@
+ # define default environment variables
+ NODE=ejabberd
+-HOST=localhost
++HOST=`hostname -s 2>/dev/null || echo "localhost"`
+ ERLANG_NODE=$NODE@$HOST
+ ERL=@erl@
+-ROOTDIR=@rootdir@
++ROOTDIR=
++MAINDIR=
+ EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg
+ LOGS_DIR=$ROOTDIR/var/log/ejabberd/
+-EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
++EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/spool
+ # read custom configuration
+ CONFIG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg
+@@ -43,10 +44,10 @@
+ ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES"
+ # define additional environment variables
+-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_EBIN=$MAINDIR/ebin
++EJABBERD_MSGS_PATH=$MAINDIR/priv/msgs
++EJABBERD_SO_PATH=$MAINDIR/priv/lib
++EJABBERD_BIN_PATH=$MAINDIR/priv/bin
+ EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log
+ SASL_LOG_PATH=$LOGS_DIR/sasl.log
+ DATETIME=`date "+%Y%m%d-%H%M%S"`
+@@ -75,14 +76,16 @@
+ # start server
+ start ()
+ {
+-    $ERL \
++     ERL_COMMAND="$ERL \
+       $NAME $ERLANG_NODE \
+       -noinput -detached \
+       -pa $EJABBERD_EBIN \
+-      -mnesia dir "\"$EJABBERD_DB\"" \
++      -mnesia dir \\\"$EJABBERD_DB\\\" \
+       -s ejabberd \
+-      -sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\} \
+-      $ERLANG_OPTS $ARGS "$@"
++      -sasl sasl_error_logger \{file,\\\"$SASL_LOG_PATH\\\"\} \
++      $ERLANG_OPTS $ARGS "$@" \
++      "
++      /sbin/runuser -s /bin/bash -p ejabberd -c "$ERL_COMMAND"
+ }
+ # attach to server
+@@ -105,7 +108,7 @@
+     read foo
+     echo ""
+     $ERL \
+-      $NAME ${NODE}debug \
++      $NAME debug-${ERLANG_NODE} \
+       -remsh $ERLANG_NODE \
+       $ERLANG_OPTS $ARGS "$@"
+ }
+@@ -139,11 +142,13 @@
+ # common control function
+ ctl ()
+ {
+-    $ERL \
+-      $NAME ejabberdctl \
++    ERL_COMMAND="$ERL \
++      $NAME ctl-${ERLANG_NODE} \
+       -noinput \
+       -pa $EJABBERD_EBIN \
+-      -s ejabberd_ctl -extra $ERLANG_NODE $@
++      -s ejabberd_ctl -extra $ERLANG_NODE $@ \
++      "
++    /sbin/runuser -s /bin/bash -p ejabberd -c "$ERL_COMMAND"
+     result=$?
+     case $result in
+     0) :;;
index 7411404..f3f5377 100644 (file)
@@ -21,6 +21,8 @@ Source9:        ejabberdctl.pam
 Source10:       ejabberdctl.apps
 Source11:       ejabberd.pam
 
+Patch1:         ejabberd-ejabberdctl_fix.diff
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  expat-devel
@@ -93,6 +95,7 @@ fi
 
 %prep
 %setup -q
+%patch1 -p0 -b .fix_ctl
 
 
 %build