diff options
Diffstat (limited to 'network/ejabberd')
-rw-r--r-- | network/ejabberd/README | 23 | ||||
-rw-r--r-- | network/ejabberd/README.SBo | 16 | ||||
-rw-r--r-- | network/ejabberd/doinst.sh | 25 | ||||
-rw-r--r-- | network/ejabberd/ejabberd.SlackBuild | 172 | ||||
-rw-r--r-- | network/ejabberd/ejabberd.info | 64 | ||||
-rw-r--r-- | network/ejabberd/rc.ejabberd | 57 | ||||
-rw-r--r-- | network/ejabberd/slack-desc | 19 |
7 files changed, 376 insertions, 0 deletions
diff --git a/network/ejabberd/README b/network/ejabberd/README new file mode 100644 index 0000000000..dc46278e0a --- /dev/null +++ b/network/ejabberd/README @@ -0,0 +1,23 @@ +ejabberd is an open-source, robust, scalable and extensible realtime +platform built using Erlang/OTP, that includes XMPP server, MQTT broker +and SIP service. + +A user and group "ejabberd" must exist prior to running this script. +To create them run as root: + groupadd -g 370 ejabberd + useradd -u 370 -g 370 -s /sbin/nologin -d /var/lib/ejabberd ejabberd + +You can enable the following optional features by passing variables to +the script (VAR=yes ejabberd.SlackBuild): + +ODBC=yes|no (default: no), enable ODBC support +MYSQL=yes|no (default: no), enable MySQL support +PGSQL=yes|no (default: no), enable PostgreSQL support +SQLITE=yes|no (default: no), enable SQLite support +PAM=yes|no (default: no), enable PAM authentication +REDIS=yes|no (default: no), enable Redis support +SIP=yes|no (default: no), enable SIP support +LUA=yes|no (default: no), enable Lua support (to import from Prosody) +TOOLS=yes|no (default: no), build development tools + +rebar3 is needed only at build time. diff --git a/network/ejabberd/README.SBo b/network/ejabberd/README.SBo new file mode 100644 index 0000000000..747f79d7fa --- /dev/null +++ b/network/ejabberd/README.SBo @@ -0,0 +1,16 @@ +In order to start ejabberd at boot and stop it properly at shutdown, +make sure rc.local and rc.local_shutdown contain the following lines: + + /etc/rc.d/rc.local + ================== + # Start ejabberd + if [ -x /etc/rc.d/rc.ejabberd ]; then + /etc/rc.d/rc.ejabberd start + fi + + /etc/rc.d/rc.local_shutdown + =========================== + # Stop ejabberd + if [ -x /etc/rc.d/rc.ejabberd ]; then + /etc/rc.d/rc.ejabberd stop + fi diff --git a/network/ejabberd/doinst.sh b/network/ejabberd/doinst.sh new file mode 100644 index 0000000000..016d743a77 --- /dev/null +++ b/network/ejabberd/doinst.sh @@ -0,0 +1,25 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.ejabberd.new +config etc/ejabberd/ejabberd.yml.new +config etc/ejabberd/ejabberdctl.cfg.new +config etc/ejabberd/inetrc.new diff --git a/network/ejabberd/ejabberd.SlackBuild b/network/ejabberd/ejabberd.SlackBuild new file mode 100644 index 0000000000..e0e6fd450c --- /dev/null +++ b/network/ejabberd/ejabberd.SlackBuild @@ -0,0 +1,172 @@ +#!/bin/bash + +# Slackware build script for ejabberd + +# Copyright 2022-2024, Alexander Verbovetsky, Moscow, Russia +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=ejabberd +VERSION=${VERSION:-24.02} +BUILD=${BUILD:-2} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +if ! grep ^ejabberd: /etc/group 2>&1 > /dev/null; then + echo " A group "ejabberd" must exist prior to running this script." + echo " # groupadd -g 370 ejabberd" + exit 1 +elif ! grep ^ejabberd: /etc/passwd 2>&1 > /dev/null; then + echo " A user "ejabberd" must exist prior to running this script." + echo " # useradd -u 370 -g 370 -s /sbin/nologin -d /var/lib/ejabberd ejabberd" + exit 1 +elif ! grep ^ejabberd:.*:/var/lib/ejabberd: /etc/passwd 2>&1 > /dev/null; then + echo " Please change the user "ejabberd" home directory to /var/lib/ejabberd." + echo " # usermod -d /var/lib/ejabberd ejabberd" + exit 1 +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION + +rm -f rebar rebar3 + +find -L $CWD -maxdepth 1 -type f \ + -name "*.tar.gz" ! -name "$PRGNAM-$VERSION.tar.gz" | while read f +do + fn=$(basename $f | rev | cut -d- -f2 | rev) + mkdir -p deps/$fn + tar xvf $f -C deps/$fn --strip-components=1 +done + +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +odbc=""; [ "${ODBC:-no}" != "no" ] && odbc="--enable-odbc" +mysql=""; [ "${MYSQL:-no}" != "no" ] && mysql="--enable-mysql" +pgsql=""; [ "${PGSQL:-no}" != "no" ] && pgsql="--enable-pgsql" +sqlite=""; [ "${SQLITE:-no}" != "no" ] && sqlite="--enable-sqlite" +pam=""; [ "${PAM:-no}" != "no" ] && pam="--enable-pam" +redis=""; [ "${REDIS:-no}" != "no" ] && redis="--enable-redis" +sip=""; [ "${SIP:-no}" != "no" ] && sip="--enable-sip" +lua=""; [ "${LUA:-no}" != "no" ] && lua="--enable-lua" +tools=""; [ "${TOOLS:-no}" != "no" ] && tools="--enable-tools" + +./autogen.sh +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --enable-user=ejabberd \ + --build=$ARCH-slackware-linux \ + --with-rebar=rebar \ + $odbc \ + $mysql \ + $pgsql \ + $sqlite \ + $pam \ + $redis \ + $sip \ + $lua \ + $tools + +unshare -n make +make install DESTDIR=$PKG + +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +find -L $PKG/usr/lib${LIBDIRSUFFIX} -type f -name "*.so" -exec chmod 755 {} \; + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +install -D -m644 tools/ejabberdctl.bc \ + $PKG/usr/share/bash-completion/completions/ejabberdctl +rm -f tools/ejabberdctl.bc + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS.md README.md sql tools \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +chown -R ejabberd:ejabberd $PKG/var/lib/ejabberd +chmod 700 $PKG/var/lib/ejabberd + +for i in `find $PKG/etc/ejabberd -type f`; do mv $i $i.new; done + +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.ejabberd > $PKG/etc/rc.d/rc.ejabberd.new + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/network/ejabberd/ejabberd.info b/network/ejabberd/ejabberd.info new file mode 100644 index 0000000000..6b5c808233 --- /dev/null +++ b/network/ejabberd/ejabberd.info @@ -0,0 +1,64 @@ +PRGNAM="ejabberd" +VERSION="24.02" +HOMEPAGE="https://www.ejabberd.im" +DOWNLOAD="https://github.com/processone/ejabberd/archive/24.02/ejabberd-24.02.tar.gz \ + https://github.com/dvv/base64url/archive/1.0.1/base64url-1.0.1.tar.gz \ + https://github.com/processone/cache_tab/archive/1.0.30/cache_tab-1.0.30.tar.gz \ + https://github.com/processone/eimp/archive/1.0.22/eimp-1.0.22.tar.gz \ + https://github.com/processone/epam/archive/1.0.14/epam-1.0.14.tar.gz \ + https://github.com/wooga/eredis/archive/v1.2.0/eredis-1.2.0.tar.gz \ + https://github.com/processone/esip/archive/1.0.52/esip-1.0.52.tar.gz \ + https://github.com/processone/ezlib/archive/1.0.12/ezlib-1.0.12.tar.gz \ + https://github.com/processone/fast_tls/archive/1.1.19/fast_tls-1.1.19.tar.gz \ + https://github.com/processone/fast_xml/archive/1.1.51/fast_xml-1.1.51.tar.gz \ + https://github.com/processone/fast_yaml/archive/1.0.36/fast_yaml-1.0.36.tar.gz \ + https://github.com/benoitc/erlang-idna/archive/6.0.0/erlang-idna-6.0.0.tar.gz \ + https://github.com/davisp/jiffy/archive/1.1.1/jiffy-1.1.1.tar.gz \ + https://github.com/potatosalad/erlang-jose/archive/1.11.5/erlang-jose-1.11.5.tar.gz \ + https://github.com/rvirding/luerl/archive/1.1.1/luerl-1.1.1.tar.gz \ + https://github.com/processone/mqtree/archive/1.0.16/mqtree-1.0.16.tar.gz \ + https://github.com/processone/p1_acme/archive/1.0.22/p1_acme-1.0.22.tar.gz \ + https://github.com/processone/p1_mysql/archive/1.0.23/p1_mysql-1.0.23.tar.gz \ + https://github.com/processone/p1_oauth2/archive/0.6.14/p1_oauth2-0.6.14.tar.gz \ + https://github.com/processone/p1_pgsql/archive/1.1.25/p1_pgsql-1.1.25.tar.gz \ + https://github.com/processone/p1_utils/archive/1.0.25/p1_utils-1.0.25.tar.gz \ + https://github.com/processone/pkix/archive/1.0.9/pkix-1.0.9.tar.gz \ + https://github.com/processone/erlang-sqlite3/archive/1.1.14/erlang-sqlite3-1.1.14.tar.gz \ + https://github.com/processone/stringprep/archive/1.0.29/stringprep-1.0.29.tar.gz \ + https://github.com/processone/stun/archive/1.2.12/stun-1.2.12.tar.gz \ + https://github.com/processone/xmpp/archive/1.8.1/xmpp-1.8.1.tar.gz \ + https://github.com/processone/yconf/archive/1.0.15/yconf-1.0.15.tar.gz \ + https://github.com/benoitc/unicode_util_compat/archive/0.4.1/unicode_util_compat-0.4.1.tar.gz" +MD5SUM="1b8b91a2b0af65685c185766dc8cf667 \ + 4d515ed34e4e8966bb7400ce51de83b2 \ + b8fd0788b9108c1dcea49fb3ba86eb77 \ + 505deb9dfe6324a6bc8e130908df105d \ + 88be9e7fec2aaa5ca8230c19db661263 \ + 239232590c82b1b7d78247079a1f17aa \ + 3bda6c2e154462c640e9fa99fe704cd8 \ + 5fd5273a71ad80b3397212dc4a9dccd3 \ + 62a46c10c57ecdc8a60783ea62edc1d0 \ + 2a7b886287b1034f0a3d07b9f15d5d59 \ + cbb767ad4f8678d91120a34402957661 \ + 1975930f1ab7d90ca14f914a8f7dacd6 \ + 5ab471571ac2b39c02a90350cecb04e3 \ + 2576e3fa9da67054de9bf67972d64bbe \ + e038b92f2c79bad70f5fb7c821d9f121 \ + f0f50e4ea6bca2abd455596209930689 \ + af192ea9a715e40db4a395341e237a0b \ + a6fff6901ff93b9687cf481934d99775 \ + a227318ad3f7665a45a2c284d203f259 \ + 3f45f0e02e532308a51e1927c7c51888 \ + 90f134a42486419966e4d64d8bdaa105 \ + db9a2e5cb2db46f0ed48b06efbcfa4c5 \ + d23c63956f6d3da25f5a75f4a70a94fd \ + 4d5dff0200768e298b166667272f5f92 \ + 80d445f62e246c55515fc6b77692c5a0 \ + 2b64f5b3d22c3a493cacdba805bde06d \ + 6f50a504c0fa81f9a5a1f63f16ff5272 \ + 1742d5522f1329229beb3e033a96898d" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="erlang-otp rebar" +MAINTAINER="Alexander Verbovetsky" +EMAIL="alik@ejik.org" diff --git a/network/ejabberd/rc.ejabberd b/network/ejabberd/rc.ejabberd new file mode 100644 index 0000000000..b231820a51 --- /dev/null +++ b/network/ejabberd/rc.ejabberd @@ -0,0 +1,57 @@ +#!/bin/bash +# Start/stop/restart the ejabberd xmpp server + +bin=/usr/sbin/ejabberdctl + +start_ejabberd() { + echo "Starting ejabberd... " + $bin start + $bin started +} + +stop_ejabberd() { + echo "Stopping ejabberd... " + $bin stop + $bin stopped +} + +restart_ejabberd() { + stop_ejabberd + sleep 1 + start_ejabberd +} + +status_ejabberd() { + $bin status +} + +force-stop_ejabberd() { + echo "Killing ejabberd... " + port=$(/usr/bin/epmd -names | awk -v name=ejabberd '$2==name {print $5}') + if [ -z "$port" ]; then + echo "ejabberd not found" + else + kill $(lsof -i TCP:$port -s TCP:LISTEN | tail -n +2 | awk '{print $2}') + fi +} + +reload-config_ejabberd() { + $bin reload_config +} + +case "$1" in + start) + start_ejabberd ;; + stop) + stop_ejabberd ;; + restart|reload) + restart_ejabberd ;; + status) + status_ejabberd ;; + force-stop) + force-stop_ejabberd ;; + reload-config) + reload-config_ejabberd ;; + *) + echo "usage $0 start|stop|restart|status|force-stop|reload-config" ;; +esac diff --git a/network/ejabberd/slack-desc b/network/ejabberd/slack-desc new file mode 100644 index 0000000000..0c1e8d5c14 --- /dev/null +++ b/network/ejabberd/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +ejabberd: ejabberd (xmpp server) +ejabberd: +ejabberd: +ejabberd: ejabberd is an open-source, robust, scalable and extensible realtime +ejabberd: platform built using Erlang/OTP, that includes XMPP server, MQTT +ejabberd: broker and SIP service. +ejabberd: +ejabberd: +ejabberd: Homepage: https://www.ejabberd.im +ejabberd: +ejabberd: |