diff options
author | root <root@rshg054.dnsready.net> | 2012-04-11 00:01:18 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-04-11 00:01:18 +0000 |
commit | 04aff5f70cb7c04abe06ca8eaf8261cbb0eeb378 (patch) | |
tree | 4935a4f0959f9560df7fba4989a0de1dc361884e /community-testing/ejabberd | |
parent | 223ca251f3ce07eb5484be845e631d6ca645b263 (diff) |
Wed Apr 11 00:01:18 UTC 2012
Diffstat (limited to 'community-testing/ejabberd')
-rw-r--r-- | community-testing/ejabberd/PKGBUILD | 44 | ||||
-rw-r--r-- | community-testing/ejabberd/ejabberd | 63 | ||||
-rw-r--r-- | community-testing/ejabberd/ejabberd.install | 26 | ||||
-rw-r--r-- | community-testing/ejabberd/ejabberd.logrotate | 12 |
4 files changed, 145 insertions, 0 deletions
diff --git a/community-testing/ejabberd/PKGBUILD b/community-testing/ejabberd/PKGBUILD new file mode 100644 index 000000000..d4bf9c2da --- /dev/null +++ b/community-testing/ejabberd/PKGBUILD @@ -0,0 +1,44 @@ +# $Id: PKGBUILD 69116 2012-04-09 13:50:43Z tdziedzic $ +# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> +# Contributor: Jeff 'codemac' Mickey <jeff@archlinux.org> +# Contributor: Alexander Rødseth <rodseth@gmail.com> + +pkgname=ejabberd +pkgver=2.1.10 +pkgrel=4 +pkgdesc="Jabber server written in Erlang" +arch=('x86_64' 'i686') +url="http://www.ejabberd.im/" +license=("GPL") +depends=('expat' 'openssl' 'zlib' 'erlang' 'pam' 'iproute2') +backup=(etc/ejabberd/ejabberd.cfg etc/logrotate.d/ejabberd) +install=$pkgname.install +source=("http://www.process-one.net/downloads/ejabberd/${pkgver/_/-}/ejabberd-${pkgver}.tar.gz" + "$pkgname.logrotate" + "$pkgname") +sha256sums=('9dc2e5889e919a7d51f2b95b83da835116631db81550a115c02e71909ad932be' + '31780cac78736d285e46f445f8c8463a70f2aeb2683280c259129db11832ddd2' + '93f8f9a8751b9e982b332f74e71f766c3c9c4818876991cadef08fe140b83ca6') + +build() { + cd "$srcdir/$pkgname-$pkgver/src" + + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --enable-pam --enable-odbc + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver/src" + + make DESTDIR="$pkgdir" install + install -D -m 0755 "$srcdir/$pkgname" "$pkgdir/etc/rc.d/$pkgname" + install -d "$pkgdir/var/spool/$pkgname" + install -d "$pkgdir/var/lib/$pkgname" + install -D -m0644 "$srcdir/$pkgname.logrotate" \ + "$pkgdir/etc/logrotate.d/$pkgname" + chmod ug+r "$pkgdir/etc/$pkgname/"* + rm -rf "$pkgdir/var/lock" +} + +# vim:set ts=2 sw=2 et: diff --git a/community-testing/ejabberd/ejabberd b/community-testing/ejabberd/ejabberd new file mode 100644 index 000000000..259d4db66 --- /dev/null +++ b/community-testing/ejabberd/ejabberd @@ -0,0 +1,63 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +cd /var/log/ejabberd/ + +get_pid() { + pidof epmd >/dev/null || { echo '' ; return 0; } + # get port from 'epmd -names', then get pid from 'ss -tlnp' + PORT=`epmd -names | grep ejabberd | cut -f5 -d\ ` + [ -z "$PORT" ] && { echo '' ; return 0; } + PID=`ss -tlnp | grep $PORT | grep -oE '[[:digit:]]+,' | cut -d, -f1` + [ -z "$PID" ] && { echo '' ; return 0; } + echo ${PID%/} +} + +case "$1" in + start) + stat_busy "Starting ejabber daemon" + + [ -d /var/lock/ejabberdctl ] || mkdir -p /var/lock/ejabberdctl + [ -f /var/run/ejabber.pid ] && rm -f /var/run/ejabber.pid + 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 + stat_fail + exit 1 + else + echo `get_pid` > /var/run/ejabberd.pid + add_daemon ejabberd + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping ejabber daemon" + PID=`get_pid` + [ ! -z "$PID" ] && su ejabberd -s /bin/bash - -c "kill $PID" &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/ejabberd.pid &> /dev/null + rm_daemon ejabberd + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/community-testing/ejabberd/ejabberd.install b/community-testing/ejabberd/ejabberd.install new file mode 100644 index 000000000..9d17a911e --- /dev/null +++ b/community-testing/ejabberd/ejabberd.install @@ -0,0 +1,26 @@ +post_install() { + groupadd -r jabber + useradd -r -G jabber -d /var/lib/ejabberd ejabberd + chown -R ejabberd.jabber /var/log/ejabberd + chown -R ejabberd.jabber /var/spool/ejabberd + chown -R ejabberd.jabber /var/lib/ejabberd + chown root:ejabberd /usr/lib/ejabberd/priv/bin/epam + chown root:ejabberd /etc/ejabberd/ejabberd.cfg /etc/ejabberd/ejabberdctl.cfg /etc/ejabberd + chmod 4750 /usr/lib/ejabberd/priv/bin/epam +} + +post_upgrade() { + chown -R ejabberd.jabber /var/log/ejabberd + chown -R ejabberd.jabber /var/spool/ejabberd + chown -R ejabberd.jabber /var/lib/ejabberd + chown root:ejabberd /etc/ejabberd/ejabberd.cfg /etc/ejabberd/ejabberdctl.cfg /etc/ejabberd + chown root:ejabberd /usr/lib/ejabberd/priv/bin/epam + chmod 4750 /usr/lib/ejabberd/priv/bin/epam +} + +post_remove() { + userdel ejabberd + groupdel jabber +} + +# vim:set ts=2 sw=2 et: diff --git a/community-testing/ejabberd/ejabberd.logrotate b/community-testing/ejabberd/ejabberd.logrotate new file mode 100644 index 000000000..03069078a --- /dev/null +++ b/community-testing/ejabberd/ejabberd.logrotate @@ -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 +} |