[Lunar-commits] <moonbase> ejabberd: Initial import, an erlang jabber (XMPP) daemon
Stefan Wold
ratler at lunar-linux.org
Tue Feb 15 21:08:02 CET 2011
commit ec25255a279f7250179ad6a88d41cc7772ef78d5
Author: Stefan Wold <ratler at lunar-linux.org>
Date: Tue Feb 15 21:08:02 2011 +0100
ejabberd: Initial import, an erlang jabber (XMPP) daemon
---
chat/ejabberd/BUILD | 23 ++++++++++++++
chat/ejabberd/DEPENDS | 4 ++
chat/ejabberd/DETAILS | 13 ++++++++
chat/ejabberd/init.d/ejabberd | 60 ++++++++++++++++++++++++++++++++++++
chat/ejabberd/logrotate.d/ejabberd | 12 +++++++
5 files changed, 112 insertions(+), 0 deletions(-)
diff --git a/chat/ejabberd/BUILD b/chat/ejabberd/BUILD
new file mode 100644
index 0000000..3e03cee
--- /dev/null
+++ b/chat/ejabberd/BUILD
@@ -0,0 +1,23 @@
+(
+
+ add_priv_user ejabberd:jabber -d /var/lib/ejabberd
+ cd src &&
+ sedit "s;EJABBERDDIR = \$(DESTDIR)@prefix@/var/lib/ejabberd;EJABBERDDIR = \$(DESTDIR)@prefix@/usr/lib/ejabberd;g" Makefile.in &&
+
+ if module_installed Linux-PAM; then
+ OPTS+=" --enable-pam"
+ fi &&
+
+ default_build &&
+
+ install -d -o ejabberd -g jabber /var/{spool,lib,log}/ejabberd &&
+ chmod 750 /var/{spool,lib,log}/ejabberd &&
+ chown root:jabber /etc/ejabberd/ejabberd.cfg /etc/ejabberd/ejabberdctl.cfg /etc/ejabberd &&
+ chmod 640 /etc/ejabberd/ejabberd.cfg /etc/ejabberd/ejabberdctl.cfg &&
+
+ if [ -f /usr/lib/ejabberd/priv/bin/epam ]; then
+ chown root:jabber /usr/lib/ejabberd/priv/bin/epam
+ chmod 4750 /usr/lib/ejabberd/priv/bin/epam
+ fi
+
+) > $C_FIFO 2>&1
diff --git a/chat/ejabberd/DEPENDS b/chat/ejabberd/DEPENDS
new file mode 100644
index 0000000..22c0c27
--- /dev/null
+++ b/chat/ejabberd/DEPENDS
@@ -0,0 +1,4 @@
+depends zlib
+depends openssl
+depends expat
+depends erlang
diff --git a/chat/ejabberd/DETAILS b/chat/ejabberd/DETAILS
new file mode 100644
index 0000000..da4f76d
--- /dev/null
+++ b/chat/ejabberd/DETAILS
@@ -0,0 +1,13 @@
+ MODULE=ejabberd
+ VERSION=2.1.6
+ SOURCE=${MODULE}-${VERSION}.tar.gz
+ SOURCE_URL=http://www.process-one.net/downloads/ejabberd/$VERSION
+SOURCE_DIRECTORY=$BUILD_DIRECTORY/$MODULE-$VERSION
+ SOURCE_VFY=sha256:b54886b119a0ae9f19c8dd91a18e85e518fbd979d47812bee582e872cfbc3544
+ WEB_SITE="http://www.ejabberd.im/"
+ ENTERED=20110215
+ UPDATED=20110215
+ SHORT="An erlang jabber server"
+cat <<EOF
+An erlang jabber server
+EOF
diff --git a/chat/ejabberd/init.d/ejabberd b/chat/ejabberd/init.d/ejabberd
new file mode 100755
index 0000000..ddc8954
--- /dev/null
+++ b/chat/ejabberd/init.d/ejabberd
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# ejabberd server
+#
+# chkconfig: 345 80 05
+# description: Ejabber server daemon
+
+get_pid() {
+ # get port from 'epmd -names', then get pid from 'netstat -tlnp'
+ PORT=$(epmd -names 2> /dev/null | grep ejabberd | cut -f5 -d\ )
+ [ -z "$PORT" ] && { echo '' ; return 0; }
+ PID=$(netstat -tlnp | grep $PORT | grep -oE '[[:digit:]]+/')
+ [ -z "$PID" ] && { echo '' ; return 0; }
+ echo ${PID%/}
+}
+
+start() {
+ [ -f /var/run/ejabber.pid ] && rm -f /var/run/ejabber.pid
+ echo -n "Starting ejabberd: "
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ su ejabberd -s /bin/bash - -c 'erl -pa /usr/lib/ejabberd/ebin -sname ejabberd -s ejabberd -ejabberd config \"/etc/ejabberd/ejabberd.cfg\" log_path \"/var/log/ejabberd/ejabberd.log\" -sasl sasl_error_logger \{file,\"/var/log/ejabberd/sasl.log\"\} -mnesia dir \"/var/spool/ejabberd\" -detached -kernel inetrc \"/etc/ejabberd/inetrc\"'
+ if [ $? -gt 0 ]; then
+ echo -e "$RESULT_FAIL"
+ exit 1
+ else
+ echo $(get_pid) > /var/run/ejabberd.pid
+ echo -e "$RESULT_OK"
+ fi
+ else
+ echo -e "$RESULT_FAIL"
+ exit 1
+ fi
+}
+
+stop() {
+ echo -n "Stopping ejabberd: "
+ PID=$(get_pid)
+ [ ! -z "$PID" ] && su ejabberd -s /bin/bash - -c "kill $PID" &> /dev/null
+ if [ $? -gt 0 ]; then
+ echo -e "$RESULT_FAIL"
+ exit 1
+ else
+ rm -f /var/run/ejabberd.pid &> /dev/null
+ echo -e "$RESULT_OK"
+ fi
+}
+
+restart() {
+ $0 stop
+ sleep 3
+ $0 start
+}
+
+case "$1" in
+ start|stop|restart) ;;
+ *) echo "Usage: $0 {start|stop|restart}" ; exit 1;;
+esac
+
+. /lib/lsb/init-functions
diff --git a/chat/ejabberd/logrotate.d/ejabberd b/chat/ejabberd/logrotate.d/ejabberd
new file mode 100644
index 0000000..0306907
--- /dev/null
+++ b/chat/ejabberd/logrotate.d/ejabberd
@@ -0,0 +1,12 @@
+/var/log/ejabberd/ejabberd.log {
+ weekly
+ missingok
+ rotate 10
+ compress
+ delaycompress
+ ifempty
+ nomail
+ sharedscripts
+ postrotate ejabberdctl --node ejabberd reopen-log > /dev/null
+ endscript
+}
More information about the Lunar-commits
mailing list