diff --git a/network/ejabberd/README b/network/ejabberd/README new file mode 100644 index 0000000000..f350ba3c09 --- /dev/null +++ b/network/ejabberd/README @@ -0,0 +1,22 @@ +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 +ELIXIR=yes|no (default: no), enable Elixir 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 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..1e3262a987 --- /dev/null +++ b/network/ejabberd/ejabberd.SlackBuild @@ -0,0 +1,171 @@ +#!/bin/bash + +# Slackware build script for ejabberd + +# Copyright 2022, 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:-22.05_git75a771b} +COMMIT=75a771bfec3626145d404349fdaec4f0eef83bbc +BUILD=${BUILD:-1} +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-$COMMIT +tar xvf $CWD/$PRGNAM-$COMMIT.tar.gz +cd $PRGNAM-$COMMIT + +find -L $CWD -type f -name "*.tar.gz" ! -name "$PRGNAM-$COMMIT.tar.gz" \ + | while read f +do + fn=$(basename $f | sed -e 's/ejabberd-po.*/ejabberd_po/' \ + | 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" +elixir=""; [ "${ELIXIR:-no}" != "no" ] && elixir="--enable-elixir" +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 \ + $odbc \ + $mysql \ + $pgsql \ + $sqlite \ + $pam \ + $redis \ + $elixir \ + $sip \ + $lua \ + $tools + +make +make install DESTDIR=$PKG + +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +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..ede054729e --- /dev/null +++ b/network/ejabberd/ejabberd.info @@ -0,0 +1,70 @@ +PRGNAM="ejabberd" +VERSION="22.05_git75a771b" +HOMEPAGE="https://www.ejabberd.im" +DOWNLOAD="https://github.com/processone/ejabberd/archive/75a771b/ejabberd-75a771bfec3626145d404349fdaec4f0eef83bbc.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/ejabberd-po/archive/9849703/ejabberd-po-9849703.tar.gz \ + https://github.com/elixir-lang/elixir/archive/v1.4.4/elixir-1.4.4.tar.gz \ + https://github.com/processone/epam/archive/1.0.12/epam-1.0.12.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.47/esip-1.0.47.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.15/fast_tls-1.1.15.tar.gz \ + https://github.com/processone/fast_xml/archive/1.1.49/fast_xml-1.1.49.tar.gz \ + https://github.com/processone/fast_yaml/archive/1.0.33/fast_yaml-1.0.33.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.1/erlang-jose-1.11.1.tar.gz \ + https://github.com/rvirding/luerl/archive/1.0/luerl-1.0.tar.gz \ + https://github.com/processone/mqtree/archive/1.0.15/mqtree-1.0.15.tar.gz \ + https://github.com/processone/p1_acme/archive/1.0.19/p1_acme-1.0.19.tar.gz \ + https://github.com/processone/p1_mysql/archive/1.0.19/p1_mysql-1.0.19.tar.gz \ + https://github.com/processone/p1_oauth2/archive/0.6.11/p1_oauth2-0.6.11.tar.gz \ + https://github.com/processone/p1_pgsql/archive/1.1.18/p1_pgsql-1.1.18.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/rebar_elixir_plugin/archive/0.1.0/rebar_elixir_plugin-0.1.0.tar.gz \ + https://github.com/processone/erlang-sqlite3/archive/1.1.13/erlang-sqlite3-1.1.13.tar.gz \ + https://github.com/processone/stringprep/archive/1.0.28/stringprep-1.0.28.tar.gz \ + https://github.com/processone/stun/archive/1.2.2/stun-1.2.2.tar.gz \ + https://github.com/processone/xmpp/archive/1.5.8/xmpp-1.5.8.tar.gz \ + https://github.com/processone/yconf/archive/1.0.13/yconf-1.0.13.tar.gz \ + https://github.com/benoitc/unicode_util_compat/archive/0.4.1/unicode_util_compat-0.4.1.tar.gz" +MD5SUM="d07080e2dbd540a649ae555fcb97fe05 \ + 4d515ed34e4e8966bb7400ce51de83b2 \ + b8fd0788b9108c1dcea49fb3ba86eb77 \ + 505deb9dfe6324a6bc8e130908df105d \ + a6c357cd991609b73132883f88fac04a \ + 55923c6db17e5e799b600ba581865e7f \ + 48028404dabbfc2ea26cedc2484386a8 \ + 239232590c82b1b7d78247079a1f17aa \ + 838e19b90c8ba181f90da9b27f127d1a \ + 5fd5273a71ad80b3397212dc4a9dccd3 \ + 4f01ae8211c09e3cad6b2ec8b798aa6f \ + 605997a85ff66db85b5657e67714db3c \ + 4ef37539360cee3b88cd25d3674fdaa7 \ + 1975930f1ab7d90ca14f914a8f7dacd6 \ + 5ab471571ac2b39c02a90350cecb04e3 \ + 169a0d3375cd58de88bf6577ef7448de \ + 05b29840a87cc8a68e1332305c68702f \ + e8a02c04daf5099df97f9ba92dea5188 \ + bd54109e32cb37cf22634aecdc732446 \ + a74b5ee76d8bdffae71a986d40763f98 \ + b6f0cdb01185ad4bcfbdd0effff0e3cf \ + f183c52c0d52f4f42cb6891ff3381189 \ + 90f134a42486419966e4d64d8bdaa105 \ + db9a2e5cb2db46f0ed48b06efbcfa4c5 \ + 74cefd398679915411076df92449b47e \ + 006f99732c11fdeb92ae90058e34dbb5 \ + 69634d72941132138e5e8827fdc85038 \ + 4509516809c5ba667d839e0700f349f1 \ + 6d65de07440a8d8fa23f2f985b5c8636 \ + adc7221fdd1ebe4c01f7e7cf9a9fce05 \ + 1742d5522f1329229beb3e033a96898d" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="erlang-otp" +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..9ff1a8a331 --- /dev/null +++ b/network/ejabberd/rc.ejabberd @@ -0,0 +1,38 @@ +#!/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 "Stoppping ejabberd... " + $bin stop + $bin stopped +} + +restart_ejabberd() { + stop_ejabberd + start_ejabberd +} + +status_ejabberd() { + $bin status +} + +case "$1" in +start) + start_ejabberd ;; +stop) + stop_ejabberd ;; +restart|reload) + restart_ejabberd ;; +status) + status_ejabberd ;; +*) + echo "usage $0 start|stop|restart|status" +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: