diff options
author | Alexander Verbovetsky <alik@ejik.org> | 2024-04-12 22:53:22 +0900 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-04-13 22:03:57 +0700 |
commit | 38fb196639b8f33c2a0b6a21812a2531b66d5acc (patch) | |
tree | 3726f1343bcdb438a50e7a6aaa4f71882515bc2c /network | |
parent | 807ff51345edcc922074a94da70800070aeb50f2 (diff) |
network/ejabberd-bin: Added (xmpp server).
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network')
-rw-r--r-- | network/ejabberd-bin/README | 13 | ||||
-rw-r--r-- | network/ejabberd-bin/README.SBo | 16 | ||||
-rw-r--r-- | network/ejabberd-bin/doinst.sh | 25 | ||||
-rw-r--r-- | network/ejabberd-bin/ejabberd-bin.SlackBuild | 124 | ||||
-rw-r--r-- | network/ejabberd-bin/ejabberd-bin.info | 16 | ||||
-rw-r--r-- | network/ejabberd-bin/rc.ejabberd | 45 | ||||
-rw-r--r-- | network/ejabberd-bin/slack-desc | 19 |
7 files changed, 258 insertions, 0 deletions
diff --git a/network/ejabberd-bin/README b/network/ejabberd-bin/README new file mode 100644 index 0000000000000..4783e1c3b88f9 --- /dev/null +++ b/network/ejabberd-bin/README @@ -0,0 +1,13 @@ +ejabberd is an open-source, robust, scalable and extensible realtime +platform built using Erlang/OTP, that includes XMPP server, MQTT broker +and SIP service. + +This script repackage the official deb package that provides a full +featured ejabberd server and does not require any extra dependencies. +It contains a stripped down version of Erlang, which does not conflict +with the SBo erlang. + +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 diff --git a/network/ejabberd-bin/README.SBo b/network/ejabberd-bin/README.SBo new file mode 100644 index 0000000000000..747f79d7fa04f --- /dev/null +++ b/network/ejabberd-bin/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-bin/doinst.sh b/network/ejabberd-bin/doinst.sh new file mode 100644 index 0000000000000..016d743a775d3 --- /dev/null +++ b/network/ejabberd-bin/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-bin/ejabberd-bin.SlackBuild b/network/ejabberd-bin/ejabberd-bin.SlackBuild new file mode 100644 index 0000000000000..bc34eef76ae58 --- /dev/null +++ b/network/ejabberd-bin/ejabberd-bin.SlackBuild @@ -0,0 +1,124 @@ +#!/bin/bash + +# Slackware build script for ejabberd-bin + +# Copyright 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-bin +VERSION=${VERSION:-24.02} +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 [ "$ARCH" != "x86_64" -a "$ARCH" != "aarch64" ]; then + echo "Only x86_64 and aarch64 are supported." + exit 1 +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} + +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 $PKG +ar p $CWD/${PRGNAM%-bin}_${VERSION}-*.deb data.tar.gz | tar xvz + +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 {} \; + +rm -r usr/share lib etc +mkdir -p etc var/{lib,log}/ejabberd +chown -R ejabberd:ejabberd var/{lib,log}/ejabberd +chmod 700 var/{lib,log}/ejabberd +rm -f opt/ejabberd/conf/*.pem +mv opt/ejabberd/conf etc/ejabberd +rmdir opt/ejabberd/{database,logs,} +chown root:ejabberd etc/ejabberd/* opt/ejabberd-*/lib/epam-*/priv/bin/epam +chmod 640 etc/ejabberd/* +chmod 4750 opt/ejabberd-*/lib/epam-*/priv/bin/epam + +sed -i -e '/^ca_file:/,/^[^ ]/{//!d}' -e '/^certfiles:/,/^[^ ]/{//!d}' \ + -e '/\(^ca_file:\|^certfiles:\)/d' etc/ejabberd/ejabberd.yml + +find -L etc/ejabberd -type f -print0 | xargs -0 -I {} mv {} {}.new + +sed -i -e 's|/opt/ejabberd/conf|/etc/ejabberd|' \ + -e 's|/opt/ejabberd/logs|/var/log/ejabberd|' \ + -e 's|/opt/ejabberd/database/\$ERLANG_NODE|/var/lib/ejabberd|' \ + opt/ejabberd-$VERSION/bin/ejabberdctl + +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 + +mkdir -p etc/rc.d +cat $CWD/rc.ejabberd > etc/rc.d/rc.ejabberd.new + +mkdir -p usr/share/bash-completion/completions +cat $CWD/ejabberdctl.bc > usr/share/bash-completion/completions/ejabberdctl + +mkdir -p usr/man/man5 +cat $CWD/ejabberd.yml.5 | gzip -9c > usr/man/man5/ejabberd.yml.5.gz + +mkdir -p usr/doc/$PRGNAM-$VERSION +cat $CWD/CHANGELOG.md > usr/doc/$PRGNAM-$VERSION/CHANGELOG.md +cat $CWD/$PRGNAM.SlackBuild > usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p install +cat $CWD/slack-desc > install/slack-desc +cat $CWD/doinst.sh > install/doinst.sh + +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/network/ejabberd-bin/ejabberd-bin.info b/network/ejabberd-bin/ejabberd-bin.info new file mode 100644 index 0000000000000..0c8fd4dd64d36 --- /dev/null +++ b/network/ejabberd-bin/ejabberd-bin.info @@ -0,0 +1,16 @@ +PRGNAM="ejabberd-bin" +VERSION="24.02" +HOMEPAGE="https://www.ejabberd.im" +DOWNLOAD="UNSUPPORTED" +MD5SUM="" +DOWNLOAD_x86_64="https://github.com/processone/ejabberd/releases/download/24.02/ejabberd_24.02-1_amd64.deb \ + https://raw.githubusercontent.com/processone/ejabberd/24.02/tools/ejabberdctl.bc \ + https://raw.githubusercontent.com/processone/ejabberd/24.02/man/ejabberd.yml.5 \ + https://raw.githubusercontent.com/processone/ejabberd/24.02/CHANGELOG.md" +MD5SUM_x86_64="4298b09b2448520321a3dae9bca9ab56 \ + 699c3c0df85c53ebed6649a2a61131a9 \ + 47c603b65521b0899bf41be2bfcc2c4a \ + 183364229c2b80a66e2a9916ec58beff" +REQUIRES="" +MAINTAINER="Alexander Verbovetsky" +EMAIL="alik@ejik.org" diff --git a/network/ejabberd-bin/rc.ejabberd b/network/ejabberd-bin/rc.ejabberd new file mode 100644 index 0000000000000..f08f3a56a2b11 --- /dev/null +++ b/network/ejabberd-bin/rc.ejabberd @@ -0,0 +1,45 @@ +#!/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 +} + +reload-config_ejabberd() { + $bin reload_config +} + +case "$1" in + start) + start_ejabberd ;; + stop) + stop_ejabberd ;; + restart|force-reload) + restart_ejabberd ;; + status) + status_ejabberd ;; + reload-config) + reload-config_ejabberd ;; + *) + echo "usage $0 start|stop|restart|force-reload|status|reload-config" ;; +esac diff --git a/network/ejabberd-bin/slack-desc b/network/ejabberd-bin/slack-desc new file mode 100644 index 0000000000000..7423ea65a67fd --- /dev/null +++ b/network/ejabberd-bin/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-bin: ejabberd-bin (xmpp server) +ejabberd-bin: +ejabberd-bin: ejabberd is an open-source, robust, scalable and extensible realtime +ejabberd-bin: platform built using Erlang/OTP, that includes XMPP server, MQTT +ejabberd-bin: broker and SIP service. +ejabberd-bin: +ejabberd-bin: This script repackage the official deb package. +ejabberd-bin: +ejabberd-bin: +ejabberd-bin: Homepage: https://www.ejabberd.im +ejabberd-bin: |