[packages/prosody] Initial commit

aredridel aredridel at pld-linux.org
Sat Feb 8 05:08:51 CET 2014


commit 3613b21ca34015e7a7f49021295dba284a7d9ef5
Author: Aria Stewart <aredridel at nbtsc.org>
Date:   Fri Feb 7 21:04:58 2014 -0700

    Initial commit

 prosody.init     |  75 ++++++++++++++++++++++++++
 prosody.service  |  12 +++++
 prosody.spec     | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 prosody.tmpfiles |   1 +
 4 files changed, 244 insertions(+)
---
diff --git a/prosody.spec b/prosody.spec
new file mode 100644
index 0000000..d1806f0
--- /dev/null
+++ b/prosody.spec
@@ -0,0 +1,156 @@
+Summary:	Flexible communications server for Jabber/XMPP
+Name:		prosody
+Version:	0.9.2
+Release:	1
+Group:		Daemons
+URL:		http://prosody.im/
+License:    MIT
+Source0:	http://prosody.im/downloads/source/%{name}-%{version}.tar.gz
+# Source0-md5:	bb91f73be0e19d049f1a57951b52c3a2
+Source1:	%{name}.init
+Source2:	%{name}.tmpfiles
+Source3:	%{name}.service
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+BuildRequires:	libidn-devel
+BuildRequires:	lua51-devel
+BuildRequires:	openssl-devel
+BuildRequires:	systemd-units
+Requires:	lua-dbi
+Requires:	lua-expat
+Requires:	lua-filesystem
+Requires:	lua-sec
+Requires(post):	systemd-units
+Requires(preun):	systemd-units
+Requires(postun):	systemd-units
+
+%description
+Prosody is a flexible communications server for Jabber/XMPP written in
+Lua. It aims to be easy to use, and light on resources. For developers
+it aims to be easy to extend and give a flexible system on which to
+rapidly develop added functionality, or prototype new protocols.
+
+
+%prep
+%setup -q
+sed -e 's|$(PREFIX)/lib|$(PREFIX)/%{_lib}|' -i Makefile
+# fix wrong end of line encoding
+sed -i -e 's|\r||g' doc/stanza.txt doc/session.txt doc/roster_format.txt
+
+%build
+./configure \
+  --with-lua-include=%{_includedir}/lua51 \
+  --lua-suffix=51 \
+  --prefix=%{_prefix}
+%{__make} CFLAGS="$RPM_OPT_FLAGS -fPIC"
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
+
+#fix perms
+chmod -x $RPM_BUILD_ROOT%{_libdir}/%{name}/%{name}.version
+
+#avoid rpmlint unstripped-binary-or-object warnings
+chmod 0755 $RPM_BUILD_ROOT%{_libdir}/%{name}/util/*.so
+
+#directories for datadir and pids
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}
+chmod 0755 $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}
+install -d $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}
+
+#systemd stuff
+install -d $RPM_BUILD_ROOT%{systemdunitdir}
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+
+#tmpfiles.d stuff
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
+install -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
+
+#install initd script
+install -d $RPM_BUILD_ROOT%{_initddir}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/%{name}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%pre
+%{_sbindir}/useradd -d %{_sharedstatedir}/%{name} -r -s /sbin/nologin %{name} 2> /dev/null || :
+
+
+%preun
+if [ $1 = 0 ]; then
+    # Package removal, not upgrade
+    %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+    /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
+    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
+    %else
+    service %{name} stop > /dev/null 2>&1 || :
+    chkconfig --del %{name} || :
+    %endif
+fi
+
+
+%post
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+    %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+    %else
+    chkconfig --add %{name} || :
+    %endif
+fi
+umask 077
+if [ ! -f %{sslkey} ] ; then
+%{_bindir}/openssl genrsa 1024 > %{sslkey} 2> /dev/null
+chown root:%{name} %{sslkey}
+chmod 640 %{sslkey}
+fi
+
+FQDN=`hostname`
+if [ "x${FQDN}" = "x" ]; then
+   FQDN=localhost.localdomain
+fi
+
+if [ ! -f %{sslcert} ] ; then
+cat << EOF | %{_bindir}/openssl req -new -key %{sslkey} \
+         -x509 -days 365 -set_serial $RANDOM \
+         -out %{sslcert} 2>/dev/null
+--
+SomeState
+SomeCity
+SomeOrganization
+SomeOrganizationalUnit
+${FQDN}
+root@${FQDN}
+EOF
+chmod 644 %{sslcert}
+fi
+
+
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+fi
+%endif
+
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS COPYING HACKERS README TODO doc/*
+%attr(755,root,root) %{_bindir}/%{name}
+%attr(755,root,root) %{_bindir}/%{name}ctl
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/*
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %attr(640, root, %{name}) %{_sysconfdir}/%{name}/*
+%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
+%{systemdunitdir}/%{name}.service
+%{_initddir}/%{name}
+%{_mandir}/man1/*.1*
+%dir %attr(-, %{name}, %{name}) %{_sharedstatedir}/%{name}
+%dir %attr(-, %{name}, %{name}) %{_localstatedir}/run/%{name}
diff --git a/prosody.init b/prosody.init
new file mode 100644
index 0000000..a5a79e1
--- /dev/null
+++ b/prosody.init
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# prosody - Flexible communications server for Jabber/XMPP
+#
+# chkconfig: - 90 10
+# description: Flexible communications server for Jabber/XMPP
+
+# http://fedoraproject.org/wiki/FCNewInit/Initscripts
+### BEGIN INIT INFO
+# Provides: prosody
+# Required-Start: network
+# Required-Stop: network
+# Default-Start: 
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop prosody
+# Description: 
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/prosodyctl"
+prog="prosody"
+user="prosody"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+    echo -n $"Starting $prog: "
+    daemon --user $user $exec start
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    daemon $exec stop 2>/dev/null
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+case "$1" in
+    start|stop|restart)
+        $1
+        ;;
+    force-reload)
+        restart
+        ;;
+    status)
+        $exec status
+        ;;
+    try-restart|condrestart)
+        if $exec status >/dev/null ; then
+            restart
+        fi
+	;;
+    reload)
+        action $"Service ${0##*/} does not support the reload action: " /bin/false
+        exit 3
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
+        exit 2
+esac
diff --git a/prosody.service b/prosody.service
new file mode 100644
index 0000000..d8eb11a
--- /dev/null
+++ b/prosody.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Prosody XMPP (Jabber) server
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/prosody/prosody.pid
+ExecStart=/usr/bin/prosodyctl start
+ExecStop=/usr/bin/prosodyctl stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/prosody.tmpfiles b/prosody.tmpfiles
new file mode 100644
index 0000000..563f04a
--- /dev/null
+++ b/prosody.tmpfiles
@@ -0,0 +1 @@
+d /var/run/prosody   710 prosody prosody
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/prosody.git/commitdiff/3613b21ca34015e7a7f49021295dba284a7d9ef5



More information about the pld-cvs-commit mailing list