Sebastian, you made me remember having this diff for a long time.
Using it in production for more than a year, but last 2 or 3
releases I always rememebered about it right at the freeze time. :(
Feel free to take any ideas from here if you want.

IIRC, I didn't implement "stop" via ejabberctl because it could
leave daemon running under some circumstances.
--
WBR,
  Vadim Zhukov


Index: patches/patch-src_Makefile_in
===================================================================
RCS file: /cvs/ports/net/ejabberd/patches/patch-src_Makefile_in,v
retrieving revision 1.3
diff -u -p -r1.3 patch-src_Makefile_in
--- patches/patch-src_Makefile_in       23 Jan 2012 10:54:47 -0000      1.3
+++ patches/patch-src_Makefile_in       9 Dec 2014 20:44:35 -0000
@@ -1,7 +1,6 @@
+$OpenBSD: patch-src_Makefile_in,v 1.3 2012/01/23 10:54:47 ajacoutot Exp $
 No need to install release notes.
 ejabberdctl mode 550 is annoying, and debian doesn't do that either
-
-$OpenBSD: patch-src_Makefile_in,v 1.3 2012/01/23 10:54:47 ajacoutot Exp $
 --- src/Makefile.in.orig       Fri Dec 23 12:27:30 2011
 +++ src/Makefile.in    Sun Jan 22 20:22:08 2012
 @@ -124,7 +124,7 @@ MSGSDIR = $(PRIVDIR)/msgs
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/ejabberd/pkg/PLIST,v
retrieving revision 1.14
diff -u -p -r1.14 PLIST
--- pkg/PLIST   24 Jan 2014 19:05:29 -0000      1.14
+++ pkg/PLIST   9 Dec 2014 20:44:35 -0000
@@ -269,9 +269,10 @@ share/examples/ejabberd/transport-config
 share/examples/ejabberd/transport-configs/init-scripts/jit
 share/examples/ejabberd/transport-configs/init-scripts/msn-transport
 share/examples/ejabberd/transport-configs/init-scripts/yahoo-transport-2
+@rcscript /etc/rc.d/ejabberd
+@mode 0750
 @owner _ejabberd
 @group _ejabberd
-@mode 0750
 @sample /var/log/ejabberd/
 @sample /var/db/ejabberd/
 @sample /var/db/ejabberd/ejabberd/
Index: pkg/README
===================================================================
RCS file: /cvs/ports/net/ejabberd/pkg/README,v
retrieving revision 1.6
diff -u -p -r1.6 README
--- pkg/README  5 May 2013 16:17:19 -0000       1.6
+++ pkg/README  9 Dec 2014 20:44:35 -0000
@@ -31,26 +31,15 @@ $OpenBSD: README,v 1.6 2013/05/05 16:17:
                 {registration_watchers, ["adm...@example.org"]},
 
 
-* Running
-  Control is done using ${TRUEPREFIX}/sbin/ejabberdctl, run it without
+* Administration
+  Control is done using ${TRUEPREFIX}/sbin/ejabberdctl. Run it without
   arguments for list of possible commands and flags. It needs to be
   executed as either root or _ejabberd user.
 
-  To start ejabberd at boot time, you may insert the following
-  into ${SYSCONFDIR}/rc.local:
-
-    if [ -x ${TRUEPREFIX}/sbin/ejabberdctl ]; then
-       echo -n ' ejabberd';   ${TRUEPREFIX}/sbin/ejabberdctl start
-    fi
-
-
-* Administration
-  ejabberdctl has some commands for administration of the server. After
-  starting ejabberd run ejabberdctl again for the list of options.
   Another possibility, giving you more options, is the web interface,
-  available at http://your.server:5280/admin/ where you need to log in
-  as a user added to admin acl group, give your full jid and your
-  account password
+  available at http://your.server:5280/admin/ . First, you need to
+  create a user in the "admin" ACL group. Then you can use his full JID
+  and account password to log in.
 
 
 * Using SSL
@@ -58,7 +47,8 @@ $OpenBSD: README,v 1.6 2013/05/05 16:17:
   generate the keys. Note that you should enter your domain name as the
   Common Name for your certificate.
     # openssl req -new -nodes -x509 -newkey rsa:4096 -days 365 \
-      -keyout ${SYSCONFDIR}/ejabberd/myserver.pem -out 
${SYSCONFDIR}/ejabberd/myserver.pem
+      -keyout ${SYSCONFDIR}/ejabberd/myserver.pem \
+      -out ${SYSCONFDIR}/ejabberd/myserver.pem
     # chown root:_ejabberd ${SYSCONFDIR}/ejabberd/myserver.pem
     # chmod 640 ${SYSCONFDIR}/ejabberd/myserver.pem
 
Index: pkg/ejabberd.rc
===================================================================
RCS file: pkg/ejabberd.rc
diff -N pkg/ejabberd.rc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/ejabberd.rc     9 Dec 2014 20:44:35 -0000
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon="${PREFIX}/bin/erl"
+daemon_ctl="${PREFIX}/sbin/ejabberdctl"
+daemon_user="_ejabberd"
+# same as ejabberdctl provides
+daemon_flags="-sname ejabberd@$(hostname -s)"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+pexp="${LOCALBASE}/lib/erlang/.*/bin/beam .* -sname ejabberd@"
+
+rc_start() {
+       ${rcexec} "${daemon_ctl} start" || return 1
+       sleep 1
+       rc_check
+}
+
+rc_cmd $1

Reply via email to