summaryrefslogtreecommitdiff
path: root/chat/ejabberd/patches/patch-ae
blob: 513b881419fd9b63710d318773e485b9231dea9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
$NetBSD: patch-ae,v 1.14 2016/04/25 20:24:14 fhajny Exp $

- Default locations.
- Make it work with NetBSD's flock(1).
- Use 'su -' instead of just 'su'. Fixes priv delegation on SunOS
  and AIX where Erlang relies on $HOME set correctly.

--- ejabberdctl.template.orig	2016-03-30 14:08:04.000000000 +0000
+++ ejabberdctl.template
@@ -27,7 +27,7 @@ if [ "$INSTALLUSER" != "" ] ; then
                 mkdir -p "$INSTALLUSER_HOME"
                 chown "$INSTALLUSER" "$INSTALLUSER_HOME"
             fi
-            EXEC_CMD="su $INSTALLUSER -c"
+            EXEC_CMD="su - $INSTALLUSER -c"
         fi
     done
     if [ `id -g` -eq `id -g $INSTALLUSER` ] ; then
@@ -73,10 +73,10 @@ if [ "$EJABBERD_CONFIG_PATH" = "" ] ; th
     EJABBERD_CONFIG_PATH=$ETC_DIR/ejabberd.yml
 fi
 if [ "$LOGS_DIR" = "" ] ; then
-    LOGS_DIR={{localstatedir}}/log/ejabberd
+    LOGS_DIR=@EJABBERD_LOGDIR@
 fi
 if [ "$SPOOL_DIR" = "" ] ; then
-    SPOOL_DIR={{localstatedir}}/lib/ejabberd
+    SPOOL_DIR=@EJABBERD_DB@
 fi
 if [ "$EJABBERD_DOC_PATH" = "" ] ; then
     EJABBERD_DOC_PATH={{docdir}}
@@ -87,7 +87,7 @@ if [ "$ERLANG_NODE_ARG" != "" ] ; then
 fi
 if [ "{{release}}" != "true" ] ; then
     if [ "$EJABBERDDIR" = "" ] ; then
-        EJABBERDDIR={{libdir}}/ejabberd
+        EJABBERDDIR={{libdir}}/erlang/lib/ejabberd
     fi
     if [ "$EJABBERD_PRIV_PATH" = "" ] ; then
         EJABBERD_PRIV_PATH=$EJABBERDDIR/priv
@@ -371,7 +371,7 @@ ctl()
     # using flock if available. Expects a linux-style
     # flock that can lock a file descriptor.
     MAXCONNID=100
-    CONNLOCKDIR={{localstatedir}}/lock/ejabberdctl
+    CONNLOCKDIR=@EJABBERD_PIDDIR@
     FLOCK=/usr/bin/flock
     if [ ! -x "$FLOCK" ] || [ ! -d "$CONNLOCKDIR" ] ; then
         JOT=/usr/bin/jot
@@ -398,7 +398,7 @@ ctl()
             CTL_LOCKFILE="$CONNLOCKDIR/$CTL_CONN"
             (
                 exec 8>"$CTL_LOCKFILE"
-                if flock --nb 8; then
+                if flock -x -n 8; then
                     ctlexec $CTL_CONN "$@"
                     ssresult=$?
                     # segregate from possible flock exit(1)