$OpenBSD: patch-src_ejabberdctl_template,v 1.6 2013/05/05 16:17:19 gonzalo Exp $
--- src/ejabberdctl.template.orig	Tue Feb  5 09:22:34 2013
+++ src/ejabberdctl.template	Mon Apr 22 12:03:23 2013
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 # define default configuration
-POLL=true
+POLL=false
 SMP=auto
 ERL_MAX_PORTS=32000
 ERL_PROCESSES=250000
@@ -9,10 +9,10 @@ ERL_MAX_ETS_TABLES=1400
 
 # define default environment variables
 NODE=ejabberd
-HOST=localhost
+HOST=`hostname -s`
 ERLANG_NODE=$NODE@$HOST
 ERL=@erl@
-INSTALLUSER=@installuser@
+INSTALLUSER=${JABBERDUSER}
 
 # parse command line parameters
 ARGS=
@@ -33,7 +33,7 @@ done
 
 # Define ejabberd variable if they have not been defined from the command line
 if [ "$ETCDIR" = "" ] ; then
-    ETCDIR=@SYSCONFDIR@/ejabberd
+    ETCDIR=${SYSCONFDIR}/ejabberd
 fi
 if [ "$EJABBERD_CONFIG_PATH" = "" ] ; then
     EJABBERD_CONFIG_PATH=$ETCDIR/ejabberd.cfg
@@ -43,10 +43,10 @@ if [ "$EJABBERDCTL_CONFIG_PATH" = "" ] ; then
 fi
 [ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH"
 if [ "$LOGS_DIR" = "" ] ; then
-    LOGS_DIR=@LOCALSTATEDIR@/log/ejabberd
+    LOGS_DIR=${EJLOGDIR}
 fi
 if [ "$SPOOLDIR" = "" ] ; then
-    SPOOLDIR=@LOCALSTATEDIR@/lib/ejabberd
+    SPOOLDIR=${EJDBDIR}/${NODE}
 fi
 if [ "$EJABBERD_DOC_PATH" = "" ] ; then
     EJABBERD_DOC_PATH=@DOCDIR@
@@ -62,7 +62,7 @@ EJID=`id -g $INSTALLUSER`
 EXEC_CMD="false"
 for GID in $GIDS; do
     if [ $GID -eq 0 ] ; then
-	EXEC_CMD="su ${INSTALLUSER} -p -c"
+	EXEC_CMD="su ${INSTALLUSER} -m -c"
     fi
 done
 if [ "$ID" -eq "$EJID" ] ; then
@@ -88,7 +88,7 @@ ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $ERL
 
 # define additional environment variables
 if [ "$EJABBERDDIR" = "" ]; then
-    EJABBERDDIR=@LIBDIR@/ejabberd
+    EJABBERDDIR=${LOCALBASE}/lib/ejabberd
 fi
 if [ "$EJABBERD_EBIN_PATH" = "" ]; then
     EJABBERD_EBIN_PATH=$EJABBERDDIR/ebin
@@ -114,7 +114,7 @@ ERL_INETRC=$ETCDIR/inetrc
 HOME=$SPOOLDIR
 
 # create the home dir with the proper user if doesn't exist, because it stores cookie file
-[ -d $HOME ] || $EXEC_CMD "mkdir -p $HOME"
+#[ -d $HOME ] || $EXEC_CMD "mkdir -p $HOME"
 
 # Change to a directory readable by INSTALLUSER to
 # prevent "File operation error: eacces." messages
@@ -250,7 +250,7 @@ ctl ()
     # using flock if available. Expects a linux-style
     # flock that can lock a file descriptor.
     MAXCONNID=100
-    CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl
+    CONNLOCKDIR=/tmp
     FLOCK='/usr/bin/flock'
     if [ ! -x "$FLOCK" ] || [ ! -d "$CONNLOCKDIR" ] ; then
 	JOT='/usr/bin/jot'
